# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1261032818 -7200 # Node ID d54f32e146dde76c6626cfd5f880e562f4f5e84c Revision: 200947 Kit: 200951 diff -r 000000000000 -r d54f32e146dd group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Haptics Services bld.inf file. +* +*/ + +#include "../hapticsservices_plat/group/bld.inf" +#include "../hapticsservices_pub/group/bld.inf" +#include "../tacticonserver/group/bld.inf" +#include "../tactilefeedback/group/bld.inf" diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the platform API specific bld.inf files, which +* export files. +* +*/ + +#include "../tacticon_api/group/bld.inf" +#include "../tactile_feedback_core_api/group/bld.inf" +#include "../tactile_feedback_server_api/group/bld.inf" diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tacticon_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tacticon_api/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to Tacticon API. +* Part of: Tacticon Server +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/tacticon.h MW_LAYER_PLATFORM_EXPORT_PATH(tacticon.h) +../inc/tacticon.hrh MW_LAYER_PLATFORM_EXPORT_PATH(tacticon.hrh) + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tacticon_api/inc/tacticon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tacticon_api/inc/tacticon.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client interface for using Tacticon server. +* Part of: Tacticon Server +*/ + +#ifndef R_TACTICON_H +#define R_TACTICON_H + +// INCLUDES +#include +#include + +/** +* Client interface to tacticon server. +* @lib tacticon.lib +* @since S60 5.2 +*/ +class RTacticon : public RSessionBase + { +public: + + /** + * C++ default constructor. + * @since S60 5.2 + */ + IMPORT_C RTacticon(); + + /** + * Creates connection to tacticon server. + * @since S60 5.2 + * @return KErrNone if successful, or one of standard Symbian OS + * error codes if creating connection fails. + */ + IMPORT_C TInt Connect(); + + /** + * Closes connection to tacticon server. + * @since S60 5.2 + */ + IMPORT_C void Close(); + +public: + /** + * Plays tacticon according to a given tacticon type. + * + * @since S60 5.2 + * @param aTacticonType - Logical tacticon type. + */ + IMPORT_C void PlayTacticon( TTacticonType aTacticonType ); + + + /** + * Stops playing current tacticon + * + * @since S60 5.2 + */ + IMPORT_C void StopTacticon(); + + /** + * Sets tacticon playback enabled/disabled. + * Client must have Write Device Data capability to use this function. + * + * @since S60 5.2 + * @param aEnabled - ETrue sets tacticon playback enabled. + * - EFalse sets tacticon playback disabled. + * @return KErrNone if succesful, or one of standard Symbian OS + * error codes. + * KErrPermissionDenied if client does not have required + * capability. + */ + IMPORT_C TInt EnableTacticons( TBool aEnabled ); + + /** + * Returns boolean value whether tacticons are enabled or disabled. + * + * @since S60 5.2 + * @return ETrue if tacticons are enabled, EFalse if disabled. + */ + IMPORT_C TBool TacticonsEnabled(); + +private: + /* + * @return Version of Tacticon Server. + */ + TVersion Version() const; + + }; + +#endif // R_TACTICON_H + +//End of File + \ No newline at end of file diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tacticon_api/inc/tacticon.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tacticon_api/inc/tacticon.hrh Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logical tacticon type enumeration. +* Part of: Tacticon Server +*/ + +#ifndef TACTICON_HRH +#define TACTICON_HRH + +/** + * Tacticon types. + */ +enum TTacticonType + { + ENoTacticon = 0, + EPositiveTacticon, + ENegativeTacticon, + ENeutralTacticon + }; + +#endif // TACTICON_HRH diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tacticon_api/tacticon_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tacticon_api/tacticon_api.metaxml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ + + + Tacticon API + Provides an interface for producing tacticons. + c++ + tacticonserver + + + + + + + + + no + no + + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_core_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_core_api/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* Tactile Feedback Core API +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/tactilefeedback.h MW_LAYER_PLATFORM_EXPORT_PATH(tactilefeedback.h) + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_core_api/inc/tactilefeedback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_core_api/inc/tactilefeedback.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client interface to tactile feedback server. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef R_TACTILEFEEDBACK_H +#define R_TACTILEFEEDBACK_H + +#include + +#include + +class CThreadPlayer; + +/** + * Client interface to tactile feedback server. + * + * @lib tactilefeedbackresolver.lib + * @since S60 5.2 + */ +class RTactileFeedback : public RSessionBase + { +public: + + /** + * C++ default constructor. + * @since S60 5.2 + */ + IMPORT_C RTactileFeedback(); + + /** + * Creates connection to tactile feedback server. + * @since S60 5.2 + * @return KErrNone if successful, or one of standard Symbian OS + * error codes if creating connection fails. + */ + IMPORT_C TInt Connect(); + + /** + * Closes connection to tactile feedback server. + * @since S60 5.2 + */ + IMPORT_C void Close(); + +public: + /** + * Produces immediately physical feedback according to given + * logical feedback type. + * + * @since S60 5.2 + * @param aFeedbackType - Logical feedback type. + * @param aPlayVibra - ETrue to play vibra feedback, EFalse if vibra + * feedback is disabled. + * @param aPlayAudio - ETrue to play audio feedback, EFalse if audio + * feedback is disabled. + */ + IMPORT_C void PlayFeedback( TTouchLogicalFeedback aFeedbackType, + TBool aPlayVibra, + TBool aPlayAudio ); + + /** + * Starts playing continuous feedback. + * + * @since S60 5.2 + * @param aType - Type of continuous feedback to be played. + * @param aIntensity - Intensity of continuous feedback. Value + * range for intensity is 0-100%. + */ + IMPORT_C void StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ); + + /** + * Modifies the intensity of ongoing continuous feedback. + * @since S60 5.2 + * @param aIntensity - New intensity for continuous feedback. Value + * range for intensity is 0-100%. + */ + IMPORT_C void ModifyFeedback( TInt aIntensity ); + + /** + * Stops the ongoing continuous feedback. + * + * @since S60 5.2 + */ + IMPORT_C void StopFeedback(); + + /** + * Enables or disables audio or/and vibra feedback in whole device. + * + * @since S60 5.2 + * @param aFeedbackType - Feedback types to be enabled/disabled + * defined as a bitmask combination of + * enumeration items from TTouchFeedbackType. + * @return KErrNone, or one of standard Symbian OS error codes if + * enabling/disabling fails. + * KErrPermissionDenied - ECapabilityWriteDeviceData required + * for using this function. + */ + IMPORT_C TInt SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ); + + /** + * Used to check enabled feedback types for the device. + * @since S60 5.2 + * @param aFeedbackEnabled - Enabled feedback types are returned to this + * parameter as a bitmask. + */ + IMPORT_C void FeedbackEnabledForDevice( TTouchFeedbackType& aFeedbackEnabled ); + + +public: + /** + * Produces immediate physical feedback according to given + * logical feedback type and given level. + * + * Maximum feedback level depends on used player and it is defined in + * Central Repository settings (KTactileFeedbackVibraLevels & + * KTactileFeedbackAudioLevels). + * + * UID for tactile feedback settings is: + * KCRUidTactileFeedback = 0x2000B494; + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedbackType - Logical feedback type. + * @param aType - Type of feedback to be previewed. + * Feedback type in preview mode must be either + * audio or haptics, not both. + */ + IMPORT_C void PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ); + /** + * Starts playing continuous feedback of given type on given level. + * + * Maximum feedback level depends on used player and it is defined in + * Central Repository settings (KTactileFeedbackVibraLevels & + * KTactileFeedbackAudioLevels). + * + * UID for tactile feedback settings is: + * KCRUidTactileFeedback = 0x2000B494; + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedback - Type of continuous feedback to be played. + * @param aIntensity - Intensity of continuous feedback. Value + * range for intensity is 0-100% from basic + * strength (see aLevel). + * @param aType - Type of feedback to be previewed. + * Feedback type in preview mode must be either + * audio or haptics, not both. + */ + IMPORT_C void StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ); + /** + * Modifies the intensity of ongoing preview of continuous feedback. + * + * @since S60 5.2 + * @param aIntensity - New intensity for continuous feedback. Value + * range for intensity is 0-100% from basic + * strength. + */ + IMPORT_C void ModifyPreviewFeedback( TInt aIntensity ); + + /** + * Stops the ongoing preview of continuous feedback. + * + * @since S60 5.2 + */ + IMPORT_C void StopPreviewFeedback(); + + +private: + /** + * Returns the version of Tactile Feedback Server. + */ + TVersion Version() const; + +private: + /** + * Instance of a class, which creates a new thread for the + * tactile feedback server + * Own. + */ + CThreadPlayer* iThread; + }; + +#endif // R_TACTILEFEEDBACK_H diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_core_api/tactile_feedback_core_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_core_api/tactile_feedback_core_api.metaxml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ + + + Tactile Feedback Core API + Provides client interface to Tactile Feedback server. + c++ + tactilefeedback + + + + + + + + + no + no + + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* Tactile Feedback Server API +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/tactilefeedbackserver.h MW_LAYER_PLATFORM_EXPORT_PATH(tactilefeedbackserver.h) +../inc/touchfeedbackadaptation.h MW_LAYER_PLATFORM_EXPORT_PATH(touchfeedbackadaptation.h) diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/inc/tactilefeedbackserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/inc/tactilefeedbackserver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Direct feedback interface for usage from Anim Dll plugins. +* Part of: Tactile Feedback. +* +*/ + +#ifndef M_TACTILEFEEDBACKSERVER_H +#define M_TACTILEFEEDBACKSERVER_H + + +#include +#include + +/** + * Direct feedback interface for Anim Dll plugins. + * + * This interface can be used for triggering feedback from Anim Dll plugins, + * or from any other DLLs which run in window server's process. + * + * Usage example: + * + * MTactileFeedbackServer* feedback = MTactileFeedbackServer::Instance(); + * if ( feedback ) + * { + * feedback->InstantFeedback( ETouchFeedbackBasic ); + * } + * + * @lib tactileclickplugin.lib + * @since S60 v5.0 + */ +class MTactileFeedbackServer + { +public: + + /** + * Can be used for acquiring a pointer to touch feedback instance. + * + * Pointer is retrieved from thread local storage, and thus it is best + * to store the returned pointer as member variable in case it shall + * be needed frequently. + * + * NULL is returned in case there is no instance. In that case + * feedback playing is not possible. + * + * @since S60 5.0 + * @return Pointer to tactile feedback instance that can be used for direct + * feedback playing. + */ + IMPORT_C static MTactileFeedbackServer* Instance(); + + + /** + * Gives instant feedback. + * + * Notice that the feedback might not be actually played, if + * for example user has disabled the feedback from the settings. + * + * @since S60 5.0 + * @param aType - The logical feedback type to play. + */ + virtual void InstantFeedback( TTouchLogicalFeedback aType ) = 0; + }; + + +#endif // M_TACTILEFEEDBACKSERVER_H diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/inc/touchfeedbackadaptation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/inc/touchfeedbackadaptation.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tactile Feedback Client Connection point to application +* framework. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef C_TOUCHFEEDBACKADAPTATION_H +#define C_TOUCHFEEDBACKADAPTATION_H + + + +#include +#include +#include +#include + + + +class CTouchFeedbackImpl; +class CTouchFeedbackClient; +class MTouchFeedback; + + +/** + * The class for instantiating and accessing Tactile Feedback Client API. + * + * Instance of this class should be created at construction phase + * of every new application. This interface is ment to be used only + * by the AppUI class for contructing and destroying the Client API, and + * for informing the client about layout changes. + * + * @lib touchfeedback.lib + * @since S60 v5.0 + */ +class CTouchFeedbackAdaptation : + public CBase, public MObjectProvider, public MCoeControlStateObserver + { + + +public: + + /** + * Instantiation method. + * + * One should not attempt to build more than one instance in each + * application process. + * + * @return New CTouchFeedbackAdaptation instance. + */ + IMPORT_C static CTouchFeedbackAdaptation* NewL(); + + virtual ~CTouchFeedbackAdaptation(); + + /** + * Used by MTouchFeedback::Instance + * + * @see MTouchFeedback. + */ + static MTouchFeedback* GetInstance(); + + /** + * Used by MTouchFeedback::CreateInstanceL + * + * @see MTouchFeedback. + */ + static MTouchFeedback* CreateInstanceL(); + + /** + * Used by MTouchFeedback::DestroyInstance + * + * @see MTouchFeedback. + */ + static void DestroyInstance(); + + /** + * Deprecated. This is still in place for keeping the .def -file + * unchanged. + */ + IMPORT_C void ControlVisibilityChanged( const CCoeControl* aControl ); + + /** + * This should be called by the application framework for informing + * that current layout has been changed. This way Tactile FW can + * disable all feedback areas in those layouts, where pen usage + * is not enabled (direct feedback is on UI controls' responsibility). + */ + IMPORT_C void LayoutChanged(); + +public: // From MObjectProvider + + /** + * We have to implement this because it is pure virtual in + * MObjectProvider, but we always return TTypeUid::Null. + * + * @param aId - Encapsulates the Uid that identifies the type of + * object required. Ignored in this class. + */ + TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); + +public: // From MCoeControlStateObserver + + /** + * This is implemented for getting notificatons when given control's + * state (i.e. visiblity or dimming status) has been changed. + * This way Tactile FW knows to disable or enable + * the feedback for that control again. + * + * @param aControl - Pointer to the control, which visiblity + * or dimming status has changed. + * @param aState - Can be used for knowing if it was dimming or + * visibility status that changed. + */ + TInt HandleControlStateChange( CCoeControl* aControl, TCoeState aState ); + +private: + + CTouchFeedbackAdaptation(); + + void ConstructL(); + + +private: // data + + /** + * The actual feedback instance. + * Own. + */ + CTouchFeedbackImpl* iTouchFeedback; + }; + + +#endif // C_TOUCHFEEDBACKADAPTATION_H diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tactile_feedback_server_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tactile_feedback_server_api.metaxml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ + + + Tactile Feedback Server API + Provides Tactile Feedback -functionality for Anim Dll plugins. + c++ + tactilefeedback + + + + + + + + + no + no + + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/conf/tctestdomtactilefeedbackserver.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/conf/tctestdomtactilefeedbackserver.cfg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,6 @@ +[Test] +title TestTactileFdbkServerInstanceL +run testscripter c:\testframework\ui_testdomtactilefeedbackserver.cfg 1 +[Endtest] + + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/conf/ui_testdomtactilefeedbackserver.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/conf/ui_testdomtactilefeedbackserver.cfg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,10 @@ +[Test] +title TestTactileFdbkServerInstanceL +bringtoforeground +create testdomtactilefeedbackserver test +test TestTactileFdbkServerInstanceL +delete test +sendtobackground +[Endtest] + + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS + + +PRJ_TESTMMPFILES +testdomtactilefeedbackserver.mmp + +PRJ_MMPFILES + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/group/testdomtactilefeedbackserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/group/testdomtactilefeedbackserver.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#include +#ifdef SBSV2 + #include +#else // SBSV2 not defined + #include +#endif // SBSV2 + +TARGET testdomtactilefeedbackserver.dll +TARGETTYPE dll +UID 0x1000008D 0x2001CB80 + +CAPABILITY ALL -TCB + +DEFFILE testdomtactilefeedbackserver.def + +#ifdef SBSV2 +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +#else // SBSV2 not defined +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +#endif // SBSV2 + +SOURCE testdomtactilefeedbackserver.cpp +SOURCE testdomtactilefeedbackserverblocks.cpp +SOURCE testtactilefeedbackserver.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY tactileclickplugin.lib + +LANG SC + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/group/testdomtactilefeedbackserver.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/group/testdomtactilefeedbackserver.pkg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,41 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Languages +&EN + +; Header +#{"testdomtactilefeedbackserver"}, (0x2001CB80), 1, 0, 0, TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + + +;Copying ordinary file (not language dependent) to fixed drive drive. + +"..\init\testdomtactilefeedbackserver.ini"-"c:\Testframework\testdomtactilefeedbackserver.ini", FF ; FF stands for Normal file +"..\conf\tctestdomtactilefeedbackserver.cfg"-"c:\Testframework\tctestdomtactilefeedbackserver.cfg", FF ; FF stands for Normal file +"..\conf\ui_testdomtactilefeedbackserver.cfg"-"c:\Testframework\ui_testdomtactilefeedbackserver.cfg", FF ; FF stands for Normal file +; ?adds your cfg file if need + +"\epoc32\RELEASE\ARMV5\urel\testdomtactilefeedbackserver.dll"-"c:\sys\bin\testdomtactilefeedbackserver.dll", FF + + +; Trim For Mms +; ------------ +; to be added later diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/inc/testdomtactilefeedbackserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/inc/testdomtactilefeedbackserver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test tactilefeedbackserver.h +* +*/ + + + +#ifndef C_TESTDOMTACTILEFEEDBACKSERVER_H +#define C_TESTDOMTACTILEFEEDBACKSERVER_H + +// INCLUDES +#include +#include +#include +#include + +// MACROS +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KtestdomtactilefeedbackserverLogPath, "\\logs\\testframework\\testdomtactilefeedbackserver\\" ); +// Log file +_LIT( KtestdomtactilefeedbackserverLogFile, "testdomtactilefeedbackserver.txt" ); +_LIT( KtestdomtactilefeedbackserverLogFileWithTitle, "testdomtactilefeedbackserver_[%S].txt" ); + +/** +* Ctestdomtactilefeedbackserver test class for STIF Test Framework TestScripter. +* @since S60 5.0 +*/ +NONSHARABLE_CLASS( Ctestdomtactilefeedbackserver ) : public CScriptBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Ctestdomtactilefeedbackserver* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Ctestdomtactilefeedbackserver(); + +public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since S60 5.0 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + +private: + + /** + * C++ default constructor. + */ + Ctestdomtactilefeedbackserver( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + /** + * TestTactileFdbkServerInstanceL test function for testing + * the Instance function + * @since S60 5.0 + * @param aItem never used + * @return Symbian OS error code. + */ + virtual TInt TestTactileFdbkServerInstanceL( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + /* + * Turn off ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void TurnOffScreenSaver(); + + /** + * Restore ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void RestoreScreenSaver(); + +private: // Data + + /** + * ScreenSaver Property + */ + TInt iOldScreenSaverProperty; + + }; + +#endif // C_TESTDOMTACTILEFEEDBACKSERVER_H + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/inc/testtactilefeedbackserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/inc/testtactilefeedbackserver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test tactilefeedbackserver.h +* +*/ + +#ifndef C_TESTTACTILEFEEDBACKSERVER_H +#define C_TESTTACTILEFEEDBACKSERVER_H + +//INCLUDE +#include +#include + +/* + * This class inherit from MTactileFeedbackServer for testing function + */ +class CTestMTactileFeedbackServer:public CBase, public MTactileFeedbackServer + { +public: + /* + * Constructor + */ + CTestMTactileFeedbackServer(); + + /* + * Destructor + */ + ~CTestMTactileFeedbackServer(); + + /* + * This function is a implement of pure implement function + */ + void InstantFeedback( TTouchLogicalFeedback aType ); + }; + +#endif /*C_TESTTACTILEFEEDBACKSERVER_H*/ + +//Endfile + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/init/testdomtactilefeedbackserver.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/init/testdomtactilefeedbackserver.ini Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,181 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND +UITestingSupport= Yes +SeparateProcesses= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= testdomtactilefeedbackservertestdomtactilefeedbackservertestdomtactilefeedbackserver +# Modules might have initialisation file, specified as +# IniFile= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testcombiner +TestCaseFile= c:\testframework\tctestdomtactilefeedbackserver.cfg +[End_Module] + +#[New_Module] +#ModuleName= testscripter +#TestCaseFile= c:\testframework\ui_testdomtactilefeedbackserver.cfg +#[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +#Load testmoduletestdomtactilefeedbackserver, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuletestdomtactilefeedbackserver used initialization file +#IniFile= init.txt + +#TestModuletestdomtactilefeedbackserver used configuration file(s) +#TestCaseFile= testcases1.cfg +#TestCaseFile= testcases2.cfg +#TestCaseFile= manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testdomtactilefeedbackserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testdomtactilefeedbackserver.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test tactilefeedbackserver.h +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "testdomtactilefeedbackserver.h" + +// CONSTANTS +_LIT( KModuleName, "testdomtactilefeedbackserver.dll" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::Ctestdomtactilefeedbackserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Ctestdomtactilefeedbackserver::Ctestdomtactilefeedbackserver( CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::~Ctestdomtactilefeedbackserver +// Destructor. +// ----------------------------------------------------------------------------- +// +Ctestdomtactilefeedbackserver::~Ctestdomtactilefeedbackserver() + { + // Delete logger + delete iLog; + + } + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Ctestdomtactilefeedbackserver::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + CleanupClosePushL( settingServer ); + TInt ret = settingServer.Connect(); + if ( ret != KErrNone ) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings( loggerSettings ); + if ( ret != KErrNone ) + { + User::Leave( ret ); + } + // Close Setting server session + settingServer.Close(); + CleanupStack::PopAndDestroy( &settingServer ); + + TFileName logFileName; + + if ( loggerSettings.iAddTestCaseTitle ) + { + TName title; + TestModuleIf().GetTestCaseTitleL( title ); + logFileName.Format( KtestdomtactilefeedbackserverLogFileWithTitle, &title ); + } + else + { + logFileName.Copy( KtestdomtactilefeedbackserverLogFile ); + } + + iLog = CStifLogger::NewL( KtestdomtactilefeedbackserverLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + TurnOffScreenSaver(); + } + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctestdomtactilefeedbackserver* Ctestdomtactilefeedbackserver::NewL( CTestModuleIf& aTestModuleIf ) + { + Ctestdomtactilefeedbackserver* self = new( ELeave ) Ctestdomtactilefeedbackserver( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +//----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Ctestdomtactilefeedbackserver::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = KModuleName; + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, + newVersionOfMethod ); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) Ctestdomtactilefeedbackserver::NewL( aTestModuleIf ); + } + +// ----------------------------------------------------------------------------- +// Turn off ScreenSaver +// ----------------------------------------------------------------------------- +// +void Ctestdomtactilefeedbackserver::TurnOffScreenSaver() + { + TInt err1 = RProperty::Get( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + TInt err2 = RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + KScreenSaverAllowScreenSaver ); + RDebug::Printf( "screensaver property=%d err1=%d err2=%d\n", + iOldScreenSaverProperty, err1, err2 ); + } + +// ----------------------------------------------------------------------------- +// Restore ScreenSaver +// ----------------------------------------------------------------------------- +// +void Ctestdomtactilefeedbackserver::RestoreScreenSaver() + { + RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + User::ResetInactivityTime(); + } + + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testdomtactilefeedbackserverblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testdomtactilefeedbackserverblocks.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test tactilefeedbackserver.h +* +*/ + + + +// [INCLUDE FILES] +#include +#include +#include +#include + +#include "testdomtactilefeedbackserver.h" +#include "testtactilefeedbackserver.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Ctestdomtactilefeedbackserver::RunMethodL( CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "TestTactileFdbkServerInstanceL", + Ctestdomtactilefeedbackserver::TestTactileFdbkServerInstanceL ), + + // [test cases entries] + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Ctestdomtactilefeedbackserver::TestTactileFdbkServerInstanceL +// ----------------------------------------------------------------------------- +// +TInt Ctestdomtactilefeedbackserver::TestTactileFdbkServerInstanceL( CStifItemParser& /*aItem*/ ) + { + CTestMTactileFeedbackServer* FbServer = new( ELeave ) CTestMTactileFeedbackServer; + CleanupStack::PushL( FbServer ); + MTactileFeedbackServer* server = FbServer->Instance(); + STIF_ASSERT_NULL( server ); + CleanupStack::PopAndDestroy( FbServer ); + return KErrNone; + } + +// [End of File] + diff -r 000000000000 -r d54f32e146dd hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testtactilefeedbackserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_plat/tactile_feedback_server_api/tsrc/src/testtactilefeedbackserver.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test tactilefeedbackserver.h +* +*/ + + +//INCLUDE +#include "testtactilefeedbackserver.h" + +// ----------------------------------------------------------------------------- +// CTestMTactileFeedbackServer::CTestMTactileFeedbackServer +// ----------------------------------------------------------------------------- +// +CTestMTactileFeedbackServer::CTestMTactileFeedbackServer() + { + + } + +// ----------------------------------------------------------------------------- +// CTestMTactileFeedbackServer::~CTestMTactileFeedbackServer +// ----------------------------------------------------------------------------- +// +CTestMTactileFeedbackServer::~CTestMTactileFeedbackServer() + { + + } + +// ----------------------------------------------------------------------------- +// CTestMTactileFeedbackServer::InstantFeedback +// ----------------------------------------------------------------------------- +// +void CTestMTactileFeedbackServer::InstantFeedback( TTouchLogicalFeedback /*aType*/ ) + { + + } + +//End file + + diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Includes all the public API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../tactile_feedback_client_api/group/bld.inf" diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +* Tactile Feedback Client API +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/touchfeedback.h MW_LAYER_PUBLIC_EXPORT_PATH(touchfeedback.h) +../inc/touchlogicalfeedback.h MW_LAYER_PUBLIC_EXPORT_PATH(touchlogicalfeedback.h) +../inc/touchfeedbackspec.h MW_LAYER_PUBLIC_EXPORT_PATH(touchfeedbackspec.h) diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/inc/touchfeedback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/inc/touchfeedback.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,703 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for using area registry and direct feedback from +* applications and UI controls. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef M_TOUCHFEEDBACK_H +#define M_TOUCHFEEDBACK_H + +#include +#include +#include + +#include +#include + +class CCoeControl; + +/** + * This is the Tactile Feedback interface for UI Controls. + * + * Provides an interface to add, modify and remove feedback areas + * in the registry. There is also an option to trigger direct feedback, + * hence bypassing the registry. + * + * Feedback areas must always be related to some UI Control (derived + * from CCoeControl). Areas are distinguished from each other based on + * control's address and an index number (so that it is possible + * to register and maintain multiple areas for same control). + * + * Clients must add, maintain and remove their feedback areas using this + * API according to the state changes of the application / control, and + * according to for e.g. device wide layout changes. + * + * There are two cases when tactile framework automatically updates the + * feedback areas for control: Feedback is always disabled when control + * becomes dimmed and re-enabled when control becomes undimmed again. + * If control becomes invisible, then feedback areas are (temporarily) + * removed, and they will be automatically added again when control + * becomes visible again. + * + * This class is not intended for derivation outside the library. + * + * @lib touchfeedback.lib + * @since S60 v5.0 + */ +class MTouchFeedback + { +public: + + /** + * Used for acquiring a pointer to touch feedback instance. + * + * Pointer is retrieved from thread local storage, and thus it is best + * to store the returned pointer as member variable in case it will + * be needed frequently. + * + * NULL is returned in case there is no instance. In that case + * CreateInstanceL -function can be used for creating a new instance. + * + * @since S60 5.0 + * @return Pointer to touch feedback instance created for this + * application process. + */ + IMPORT_C static MTouchFeedback* Instance(); + + /** + * Creates a new touch feedback instance. The usage of + * this function should only be necessary from processes which + * are not GUI applications, but which still have user interface + * (or want to play direct feedback). + * + * DestroyInstance -function must be called for deleting the instance + * when it is no longer needed. + * + * @since S60 5.0 + * @return Pointer to new touch feedback instance. + */ + IMPORT_C static MTouchFeedback* CreateInstanceL(); + + /** + * Destroys the touch feedback instance and clears pointer in + * thread local storage. + * + * This function must only be used in case touch feedback has been + * created with CreateInstanceL -function. I.e. normal GUI applications + * should never call this function. + * + * @since S60 5.0 + */ + IMPORT_C static void DestroyInstance(); + + /** + * This function can be used to check, whether touch feedback is + * supported at all in the device. + * + * All the API functions can be called safely even if touch feedback + * is not enabled (for e.g. in devices without touch screen). But in + * some situations registry updates can require complex calculations, + * which can be skipped if touch feedback is not enabled at all. + * + * Notice that the settings related to touch feedback have no effect + * on the behavior of this function. I.e. even if user turns touch + * feedback OFF from settings, this function still returns + * ETrue. The reason for this is that registry updates must be done + * anyway even if the feedback is not on for the moment, because + * user can turn it on at anytime, and it is not possible to force + * an update for all applications in that case. + * + * @since S60 5.0 + * @return ETrue if touch feedback is supported in this device. + */ + virtual TBool TouchFeedbackSupported() = 0; + + /** + * Used for disabling or enabling feedback in the application. + * + * Tactile feedback is enabled by default, and thus standard + * S60 components (such as CBA, lists and options menu) automatically + * give feedback even if the application itself would make no effort + * for producing feedback. + * + * For some applications (such as games) feedback might not be + * wanted at all. In addition some applications may need to disable + * feedback in some specific situations. For example: A camera + * application may need to disable feedback during video recording, + * because otherwise feedbacks may cause disturbing sounds that + * will be recorded into the video clip. + * + * Notice that this function only affects direct feedback and + * area registry based feedback for this application. I.e. if this + * application is taken to background, other applications can still + * produce feedback. + * + * Also notice that enabling feedback doesn't still mean that feedback + * would necessarily be generated, because user may have disabled the + * feedback for whole device from the settings. + * + * @since S60 5.0 + * @param aEnabled - Give ETrue as parameter for enabling feedback, and + * EFalse for disabling feedback. + */ + virtual void SetFeedbackEnabledForThisApp( TBool aEnabled ) = 0; + + /** + * Used to check whether feedback is enabled for this application. + * + * Notice that this function only returns what was given as parameter + * to SetFeedbackEnabledForThisApp -function. I.e. this function + * can return ETrue even if feedback would be currently disabled + * from settings. + * + * If only vibra or audio feedback is enabled, this function still + * returns ETrue. + * + * @since S60 5.0 + * @return ETrue if feedback is enabled for this application. + */ + virtual TBool FeedbackEnabledForThisApp() = 0; + + /** + * Sets or updates rectangular feedback area to registry. + * + * If this is new area (i.e. there is not yet area with given control + * address and area index in the registry), then this area will be + * added as the top priority area for its window, i.e. this + * area will be hit test first when pointer event arrives. + * + * Notice however, that this area will remain as top priority area only + * until the next new area is added to the registry, or until + * MoveFeedbackAreaToFirstPriority -function is called. I.e. new areas + * are always put on top priority, but they will only remain on top + * until they will be overridden by next area. + * + * The control that is given as parameter should usually be the one + * that is responsible of handling the pointer events on the + * corresponding feedback area. + * + * The area can later be identified by passing control pointer and + * index as parameters to the other functions (for modifying or + * removing the feedback area). In case control only + * registers one area, then index 0 can always be used. Usually most + * sensible approach is to use indexes 1, 2, 3 etc. for additional + * feedback areas, but in practice any desired index values can be + * used. + * + * Notice that if given control is dimmed, then feedback type will + * be set to "None". If given control is not visible, then feedback + * area will not be added to registry at all (for now). However, + * registry is automatically updated when control's dimming or + * visibility changes, so one can call this function also for + * dimmed and invisible control. + * + * When the control given as parameter to this function is destroyed, + * then the RemoveFeedbackForControl -function must be called while + * giving the same control as parameter again. This is necessary + * for removing all the feedback areas, and also for resetting the + * state information stored by the API implementation. + * + * @since S60 5.0 + * @param aControl - The control handling pointer events on this + feedback area. + * @param aIndex - The index number of the area to be added. + * @param aRect - The feedback area rectangle. + * @param aFeedbackType - The logical feedback type given + * @param aEventType - The pointer event type that triggers the + * feedback (currently only ETouchEventStylusDown + * is supported). + * @return KErrNone, or one of standard Symbian OS error codes + * if setting of area to registry failed. + * Some specific error codes: + * KErrArgument - A NULL pointer was given as first parameter, or + * the given control does not have any window + * associated to it. + * KErrNotSupported - Unsupported logical feedback type or + * event type was given as parameter. + */ + virtual TInt SetFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + TTouchLogicalFeedback aFeedbackType, + TTouchEventType aEventType ) = 0; + + /** + * Removes feedback area from the registry. + * + * This function is designed to be used in case feedback areas + * need to be removed elsewhere than in control's destructor. In + * control's destructor RemoveFeedbackForControl -function must be + * used instead. + * + * @since S60 5.0 + * @param aControl - The control, who has registered the area. + * @param aIndex - The index of the area to be removed. + */ + virtual void RemoveFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex ) = 0; + + /** + * Removes all feedback areas of specified control from registry. + * + * This function also clears all related data that has been cached + * by the API implementation, and thus it must always be called from + * control's destructor in case control has used any of the following + * functions: + * - SetFeedbackArea + * - EnableFeedbackForControl + * + * Especially notice that it is not enough to remove all feedback areas + * individually by using RemoveFeedbackArea -function. + * + * The difference between this function and EnableFeedbackForControl + * -function is that this function really removes all areas related + * to this control from registry, whereas EnableFeedbackForControl + * (when EFalse if given as parameter) only temporarily disables + * those areas. + * + * @since S60 5.0 + * @param aControl - Pointer to the control, whose area registry + * entries and cached information will be removed. + */ + virtual void RemoveFeedbackForControl( const CCoeControl* aControl ) = 0; + + /** + * Changes feedback area in the registry. + * + * The area must have been originally added to the registry with + * SetFeedbackArea -function, or otherwise this function will + * do nothing. + * + * This function is intended to be used especially in + * portrait / landscape changes. + * + * If given CCoeControl pointer is NULL, then this function call + * does nothing. + * + * @since S60 5.0 + * @param aControl - The control, who has registered the area. + * @param aIndex - The index number of the area, that will be changed. + * @param aNewRect - New area rectangle for given feedback area. + */ + virtual void ChangeFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aNewRect ) = 0; + + /** + * Changes feedback type in the registry. + * + * Feedback can be temporarily disabled by giving ETouchFeedbackNone + * as parameter (although using EnableFeedbackForControl function with + * parameter EFalse is usually better for this functionality). + * + * The area must have been originally added to the registry with + * SetFeedbackArea -function, or otherwise this function will + * do nothing. + * + * If given control pointer is NULL, then this function call + * is ignored. + * + * This function only changes feedback type for down event. + * To change feedback types for all the events in the feedback area use + * function SetFeedbackArea with CFeedbackSpec container class + * definion instead. + * + * @since S60 5.0 + * @param aControl - The control, who has registered the area. + * @param aIndex - The index number of the area, that will be changed. + * @param aNewType - New feedback type for the area. + */ + virtual void ChangeFeedbackType( const CCoeControl* aControl, + TUint32 aIndex, + TTouchLogicalFeedback aNewType ) = 0; + + + /** + * Makes the given feedback area the first priority area in the window + * where it is located. + * + * In practice this means that this will be the first area that is + * hit tested when a pointer event arrives. + * + * Notice however, that this area will only keep its top priority status + * until the next area is added to the registry, or until + * this function is called again for some other area. I.e. there is no + * way for giving any area a permanent status as top priority area + * (Registry works as a stack, and new items are added on top). + * + * If given control pointer is NULL, this function call does nothing. + * + * @since S60 5.0 + * @param aControl - The control, who has registered the area. + * @param aIndex - The index number of the area, which + * will be prioritized. + */ + virtual void MoveFeedbackAreaToFirstPriority( const CCoeControl* aControl, + TUint32 aIndex ) = 0; + + /** + * This function forces all registry changes made on client side to be + * sent to server side immediately. + * + * This operation causes always immediate and synchronous client-server + * transaction, and can possibly also cause flushing of window server + * client side buffer. Hence this function should only be used in case + * there is a synchronization problem so that feedback triggered from + * area registry does not correspond to the areas defined by application. + * + * This function is only likely to help in such situation, where this + * application's active objects are running all the time for several seconds, + * because in that case updates won't be transferred to server immediately. + * + * Calling this function has no effect in case there are no pending + * area registry updates. + * + * @since S60 5.0 + */ + virtual void FlushRegistryUpdates( ) = 0; + + /** + * Gives direct feedback. + * + * Notice that the feedback might not be actually played, if + * for example user has disabled the feedback from the settings. + * + * This function always causes a synchronous client-server transaction, + * and potentially flushing of window server client-side buffer. + * + * @since S60 5.0 + * @param aType - The logical feedback type to play. + */ + virtual void InstantFeedback( TTouchLogicalFeedback aType ) = 0; + + /** + * Gives direct feedback if given control has not disabled it. + * + * This function only gives feedback, if EnableFeedbackForControl + * function has NOT been called on given control with second + * parameter EFalse. + * + * This overload is recommended when + * feedback is triggered from UI controls, because then the owner + * of the control can decide whether both area registry based and + * direct feedback should be enabled or not. + * + * If feedback is enabled for the given control, then this function + * causes a synchronous client-server transaction, + * and potentially flushing of window server client-side buffer. + * + * @since S60 5.0 + * @param aControl - The control, who wishes to play feedback. + * @param aType - The logical feedback type to play. + */ + virtual void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType ) = 0; + + + /** + * Can be used for querying, whether given control has any feedback + * areas registered. + * + * It does not matter whether the areas are disabled or enabled for + * the moment. + * + * Notice that one should not usually call this function, as it + * is always allowed to call for example RemoveFeedbackArea + * -function without checking if the area really exists (this + * is done internally in the API implementation anyway). + * + * @since S60 5.0 + * @param aControl - Pointer to the control, whose feedback is + * queried. + * @return ETrue if the given control has at least one feedback + * area defined. EFalse otherwise. + */ + virtual TBool ControlHasFeedback( const CCoeControl* aControl ) = 0; + + /** + * Can be used for querying, whether given control has a feedback + * area defined with given index number. + * + * It does not matter whether the areas are disabled or enabled for + * the moment. + * + * Notice that one should not usually call this function, as it + * is always allowed to call for example RemoveFeedbackArea + * -function without checking if the area really exists (this + * is done internally in the API implementation anyway). + * + * @since S60 5.0 + * @param aControl - Pointer to the control, whose feedback is + * queried. + * @param aIndex - The index number of the area which is queried. + * @return ETrue if the given control has a feedback area defined + * with given index number. EFalse otherwise. + */ + virtual TBool ControlHasFeedback( const CCoeControl* aControl, + TUint32 aIndex ) = 0; + + /** + * This function enables or disables all feedback areas registered for + * the given control. Disabling also affects to the overloaded version + * of InstantFeedback -function, so that feedback is not played if + * the control given as parameter has its feedback disabled. + * + * This function can be used for temporarily disabling + * the feedback for some given control. Calling with second parameter + * ETrue re-enables feedback areas, but it still does not + * guarantee any feedback (control can be dimmed, invisible, of may not + * even have any feedback areas registered). + * + * This function affects both vibra- and audio feedback. + * + * Any control that uses this function must call RemoveFeedbackForControl + * -function in its destructor. + * + * @since S60 5.0 + * @param aControl - Pointer to control, whose feedback will be + * enabled or disabled according to second parameter. + * @param aEnable - Use EFalse for temporary disabling the feedback for + * this control, and ETrue for restoring the situation + * to normal. + */ + virtual void EnableFeedbackForControl( const CCoeControl* aControl, + TBool aEnable ) = 0; + + /** + * This function can be used for separately enabling or disabling audio- + * and vibra feedback for the given control. + * + * Otherwise the function behaves in the same way as the overload with + * only one TBool parameter. + * + * Any control that uses this function must call RemoveFeedbackForControl + * -function in its destructor. + * + * @since S60 5.0 + * @param aControl - Pointer to control, whose audio- and vibra + * feedback will be enabled or disabled according + * to given parameters. + * @param aEnableVibra - Use EFalse for temporary disabling the vibra + * feedback for this control, and ETrue for + * restoring the situation to normal. + * @param aEnableAudio - Use EFalse for temporary disabling the audio + * feedback for this control, and ETrue for + * restoring the situation to normal. + */ + virtual void EnableFeedbackForControl( const CCoeControl* aControl, + TBool aEnableVibra, + TBool aEnableAudio ) = 0; + + /** + * Used for disabling/enabling audio/vibra feedback in + * the application. + * + * This is identical with the overload which has only one parameter, + * with the exception that one can disable audio and vibra feedback + * separately with this version. + * + * @since S60 5.0 + * @param aVibraEnabled - Give ETrue as parameter for enabling vibra + * feedback, and EFalse for disabling vibra + * feedback for this application. + * @param aAudioEnabled - Give ETrue as parameter for enabling audio + * feedback, and EFalse for disabling audio + * feedback for this application. + */ + virtual void SetFeedbackEnabledForThisApp( TBool aVibraEnabled, + TBool aAudioEnabled ) = 0; + + + /** + * Used to check whether audio or vibra feedback is enabled for this application. + * + * Notice that this function only returns what was given as parameter + * to SetFeedbackEnabledForThisApp -function. I.e. this function + * can return ETrue even if feedback would be currently disabled + * from settings. + * + * @since S60 5.2 + * @param aFeedbackType - Feedback type. + * @return ETrue if asked feedback type is enabled for this application. + */ + virtual TBool FeedbackEnabledForThisApp( TTouchFeedbackType aFeedbackType ) = 0; + + /** + * Starts continuous feedback if given control has not disabled it. + * + * Only one continuous feedback per control can be played simultaneously. + * Started feedback will be stopped automatically if application loses + * key focus or application crashes or some other control starts + * continuous feedback. + * + * If StartFeedback is called again for the same control, then feedback + * type and intensity are modified accordingly. This may cause a break + * in the feedback effect in case feedback type changes. + * + * EnableFeedbackForControl also affects to this function so that + * feedback is not given if EnableFeedbackForControl + * function has been called with second and third parameter EFalse. + * + * @since S60 5.2 + * @param aControl - The control, who wishes to play feedback. + * @param aType - The continuous feedback type to play. + * @param aPointerEvent - Pointer event which triggered this feedback + * (give NULL as parameter if no related pointer + * event available) + * @param aIntensity - Feedback intensity to begin with. range 0-100%. + * Use 50% if no reason to use other value. + * @param aTimeout - Timeout value to automatically stop continuous + * feedback if there's no new Start call within the + * timeout. Use value 0 if timeout is not used. + */ + virtual void StartFeedback( const CCoeControl* aControl, + TTouchContinuousFeedback aType, + const TPointerEvent* aPointerEvent, + TInt aIntensity, + TTimeIntervalMicroSeconds32 aTimeout ) = 0; + + + /** + * This function modifies intensity of continuous feedback on the fly. + * + * @since S60 5.2 + * @param aControl - The control which continuous feedback is modified. + * @param aIntensity - New intensity value. range 0-100% + */ + virtual void ModifyFeedback( const CCoeControl* aControl, + TInt aIntensity ) = 0; + + + /** + * This function stops continuous feedback. + * + * @since S60 5.2 + * @param aControl - The control which continuous feedback is stopped. + */ + virtual void StopFeedback( const CCoeControl* aControl ) = 0; + + + /** + * This function enables or disables audio or/and vibra feedback in + * whole device. + * + * Tactile feedback is enabled by default, and thus standard + * S60 components (such as CBA, lists and options menu) automatically + * give feedback even if the application itself would make no effort + * for producing feedback. + * + * Requires WriteDeviceData capability + * + * @since S60 5.2 + * @param aFeedbackType - Feedback types to be enabled/disabled defined as + * a bitmask combination of enumeration items from + * TTouchFeedbackType + * @return KErrNone, or one of standard Symbian OS error codes + * if user has not WriteDeviceData capability. + */ + virtual TInt SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ) = 0; + + + /** + * Used to check enabled feedback types for the device. + * + * Notice that this function only returns what was given as parameter + * to SetFeedbackEnabledForDevice -function. I.e. this function + * can return ETrue even if feedback would be currently disabled + * from settings. + * + * @since S60 5.2 + * @return Enabled/disabled feedback types as bitmask combination. + */ + virtual TTouchFeedbackType FeedbackEnabledForDevice() = 0; + + + /** + * Gives direct feedback if given control has not disabled it. + * + * This overload is recommended when triggered feedback is related + * to pointer event. System uses aPointerEvent to avoiding + * two (or more) direct feedbacks for the same pointer event. + * + * @since S60 5.2 + * @param aControl - The control, who wishes to play feedback. + * @param aType - The logical feedback type to play. + * @param aPointerEvent - pointer event which triggered this feedback. + */ + virtual void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + const TPointerEvent& aPointerEvent ) = 0; + + + /** + * Sets or updates rectangular feedback area to registry. + * + * This overload allows user to set more than one touch event types to + * one feedback area. Otherwise the function behaves in the same way + * as the overload with separated feedback type and event type parameters. + * + * @since S60 5.2 + * @param aControl - The control handling pointer events on this + * feedback area. + * @param aIndex - The index number of the area to be added. + * @param aRect - The feedback area rectangle. + * @param aFeedbackSpec - The specification how this feedback area + * triggers feedback for different touch events. + * @return KErrNone, or one of standard Symbian OS error codes + * if setting of area to registry failed. + * Some specific error codes: + * KErrArgument - A NULL pointer was given as first parameter, or + * the given control does not have any window + * associated to it. + * KErrNotSupported - Unsupported predefined feedback profile + * was given as parameter. + */ + virtual TInt SetFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + CFeedbackSpec* aFeedbackSpec ) = 0; + + /** + * Gives direct feedback if given control has not disabled it. + * + * This overload is recommended when triggered feedback is related + * to pointer event. System uses aPointerEvent to avoiding + * two (or more) direct feedbacks for the same pointer event. Using this + * overload it is also possible to disable unwanted feedback (vibra/audio) + * by giving only wanted feedback type as parameter. + * + * @since S60 5.2 + * @param aControl - The control, who wishes to play feedback. + * @param aType - The logical feedback type to play. + * @param aFeedbackType - Feedback types to be played as a bitmask + * combination of enumeration items from + * TTouchFeedbackType + * @param aPointerEvent - Pointer event, which triggered this feedback. + */ + virtual void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + TTouchFeedbackType aFeedbackType, + const TPointerEvent& aPointerEvent ) = 0; + + + + }; + + + +#endif // M_TOUCHFEEDBACK_H diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/inc/touchfeedbackspec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/inc/touchfeedbackspec.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Container for composit feedback types. +* Part of: Tactile Feedback. +* +*/ + +#ifndef C_FEEDBACKSPEC_H +#define C_FEEDBACKSPEC_H + +#include +#include + + +// Container for one event/feedback type pair +struct TTactileFbItem + { + TTouchEventType iEventType; + TTouchLogicalFeedback iFeedback; + TTouchFeedbackType iFeedbackType; + }; + +/** + * Contains feedback types used for setting feedback area + * + * This class acts as container for event/feedback type pairs. These pairs + * define what kind of feedback is producent when area is touched. + * + * @lib touchfeedback.lib + * @since S60 5.2 + */ +class CFeedbackSpec: public CBase + { +public: + /** + * Instantiation method. + * + * @since S60 5.2 + * @return New CFeedbackSpec instance. + */ + IMPORT_C static CFeedbackSpec* New(); + + /** + * Destructor. + * + * @since S60 5.2 + */ + virtual ~CFeedbackSpec(); + + /** + * Adds event/feedback type pair to feedback spec + * + * @since S60 5.2 + * @param aEventType - Touch event type. + * @param aFeedback - Logical feedback type. + * @return KErrNone, or one of standard Symbian OS error codes. + */ + IMPORT_C TInt AddFeedback( TTouchEventType aEventType, + TTouchLogicalFeedback aFeedback ); + + /** + * Gets defined event/feedback type pairs + * + * @since S60 5.2 + * @param aArray - Event/feedback type pairs is returned here. + */ + IMPORT_C void GetFeedbackSpec( RArray& aArray ); + + /** + * Adds event/feedback type pair to feedback spec. + * Using this overload it is possible to define only one feedback type + * (vibra/audio) for event. + * + * @since S60 5.2 + * @param aEventType - Touch event type. + * @param aFeedback - Logical feedback type. + * @param aFeedbackType - Bitmask to define feedback type (vibra/audio). + * @return KErrNone, or one of standard Symbian OS error codes. + */ + IMPORT_C TInt AddFeedback( TTouchEventType aEventType, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aFeedbackType ); + + +private: + /** + * Constructor. + */ + CFeedbackSpec(); + +private: // data + + /** + * Array for event type/feedback type pairs + * Own. + */ + RArray iFbArray; + }; + +#endif // C_FEEDBACKSPEC_H diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/inc/touchlogicalfeedback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/inc/touchlogicalfeedback.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Logical feedback type enumeration. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TOUCHLOGICALFEEDBACK_H +#define TOUCHLOGICALFEEDBACK_H + +#include + +/** + * Pointer event types, that can be used when registering + * areas to registry. + */ +enum TTouchEventType + { + ETouchEventStylusDown, + ETouchEventStylusUp, + ETouchEventStylusPressDown, + ETouchEventStylusPressUp + }; + +/** + * Logical feedback types, that can be used when producing direct + * feedback, or when registering areas to area registry. + * + * Notice, that client application cannot decide the actual physical + * feedback that shall be generated. It depends on device configuration, + * and current settings. In current devices the user changeable settings + * includes vibra and sound feedbacks. + * + * Instructions for using these feedback types: + * + * ETouchFeedbackNone - Use for disabling feedback for some areas of + * window when using area registry. + * + * ETouchFeedbackBasic - Use as default feedback for pen down events. + * For example, pressing a button or tab. + * + * ETouchFeedbackSensitive - Sensitive feedback for those situations, + * where the triggering action is not very + * important (e.g. change focus in list), or when + * there can be a large amount of feedbacks in + * a short time (e.g. text selection which gives + * feedback on every new selected character). + * Also used for scrolling and dragging. + * + * Different UI components have specific feedback types, which should be + * used to maintain similar feedback behaviour in components of same type. + * + */ +enum TTouchLogicalFeedback + { + ETouchFeedbackNone = 0, + ETouchFeedbackBasic, + ETouchFeedbackSensitive, + // New types for S60 5.2: + ETouchFeedbackBasicButton = 0x100, + ETouchFeedbackSensitiveButton, + ETouchFeedbackList, + ETouchFeedbackSensitiveList, + ETouchFeedbackBoundaryList, + ETouchFeedbackSlider, + ETouchFeedbackEdit, + ETouchFeedbackLineSelection, + ETouchFeedbackBlankSelection, + ETouchFeedbackTextSelection, + ETouchFeedbackEmptyLineSelection, + ETouchFeedbackTab, + ETouchFeedbackPopUp, + ETouchFeedbackIncreasingPopUp, + ETouchFeedbackDecreasingPopUp, + ETouchFeedbackFlick, + ETouchFeedbackCheckbox, + ETouchFeedbackSensitiveInput, + ETouchFeedbackCharacterInputButton, + ETouchFeedbackMultiTouchRecognized + }; + +/** + * Logical feedback types for producing continuous feedback. + * + */ +enum TTouchContinuousFeedback + { + ETouchContinuousSmooth = 0x300, // For generic continuous feedback for custom controls + ETouchContinuousSlider, + ETouchContinuousInput, + ETouchContinuousFlick + }; + +/** + * Physical feedback types as bitmask. + * + */ +enum TTouchFeedbackType + { + ETouchFeedbackAudio = 0x01, + ETouchFeedbackVibra = 0x02 + }; + +#endif // TOUCHLOGICALFEEDBACK_H diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tactile_feedback_client_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tactile_feedback_client_api.metaxml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ + + + Tactile Feedback Client API + Provides applications and UI controls a centralized way for producing tactile feedback for different touch events. + c++ + tactilefeedback + + + + + + + + + no + no + + diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/conf/tctestsdktfc.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/conf/tctestsdktfc.cfg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,13 @@ + + +[Test] +title TestTFBInstance +run testscripter c:\testframework\ui_testsdktfc.cfg 1 +[Endtest] + + + +[Test] +title TestTFBDestroyInstance +run testscripter c:\testframework\ui_testsdktfc.cfg 2 +[Endtest] diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/conf/ui_testsdktfc.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/conf/ui_testsdktfc.cfg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,19 @@ + + +[Test] +title TestTFBInstance +create testsdktfc test +test TestTFBCreateInstanceL +test TestTFBInstance +delete test +[Endtest] + + + +[Test] +title TestTFBDestroyInstance +create testsdktfc test +test TestTFBCreateInstanceL +test TestTFBDestroyInstance +delete test +[Endtest] diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + + +PRJ_EXPORTS + + +PRJ_TESTMMPFILES +testsdktfc.mmp + +PRJ_MMPFILES + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/group/testsdktfc.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/group/testsdktfc.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,54 @@ +/*TYPE TESTCLASS*//* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tactile_feedback_client_api +* +*/ + + +#include +#include + +TARGET testsdktfc.dll +TARGETTYPE dll +UID 0x1000008D 0x2001CB80 + +CAPABILITY ALL -TCB + +DEFFILE testsdktfc.def + +#ifdef SBSV2 + USERINCLUDE ../inc + + MW_LAYER_SYSTEMINCLUDE + + SOURCEPATH ../src +#else // SBSV2 not defined +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +#endif // SBSV2 + +SOURCE testsdktfc.cpp +SOURCE testsdktfcblocks.cpp + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY touchfeedback.lib + +LANG SC + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/group/testsdktfc.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/group/testsdktfc.pkg Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,41 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Languages +&EN + +; Provide value for uid +#{"testsdktfc"},(0x2001CB80),1,1,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +"..\init\testsdktfc.ini"-"c:\Testframework\testsdktfc.ini", FF ; FF stands for Normal file +"..\conf\tctestsdktfc.cfg"-"c:\Testframework\tctestsdktfc.cfg", FF ; FF stands for Normal file +"..\conf\ui_testsdktfc.cfg"-"c:\Testframework\ui_testsdktfc.cfg", FF ; FF stands for Normal file +; ?adds your cfg file if need + +"\epoc32\RELEASE\ARMV5\urel\testsdktfc.dll"-"c:\sys\bin\testsdktfc.dll", FF + + +; Trim For Mms +; ------------ +; to be added later + diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/inc/testsdktfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/inc/testsdktfc.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tactile_feedback_client_api +* +*/ + + + +#ifndef C_TESTSDKTFC_H +#define C_TESTSDKTFC_H + +// INCLUDES +#include +#include +#include +#include + +// MACROS +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KtestsdktfcLogPath, "\\logs\\testframework\\testsdktfc\\" ); +// Log file +_LIT( KtestsdktfcLogFile, "testsdktfc.txt" ); +_LIT( KtestsdktfcLogFileWithTitle, "testsdktfc_[%S].txt" ); + +/** +* CTestSDKTFC test class for STIF Test Framework TestScripter. +* @since S60 5.0 +*/ +NONSHARABLE_CLASS(CTestSDKTFC) : public CScriptBase + { +public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CTestSDKTFC* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CTestSDKTFC(); + +public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since S60 5.0 + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + +private: + + /** + * C++ default constructor. + */ + CTestSDKTFC( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since S60 5.0 + */ + void Delete(); + + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + /** + * Turn off ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void TurnOffScreenSaver(); + + /** + * Restore ScreenSaver + * @since S60 5.0 + * @return Symbian OS error code. + */ + void RestoreScreenSaver(); + + //[TestMethods] +private:// for test the touchfeedback.h + /** + * TestTFCInstance test method for test the Instance method. + * @since S60 5.0 + * @return Symbian OS error code. + */ + virtual TInt TestTFBInstance( CStifItemParser& aItem ); + /** + * TestTFCCreateInstanceL test method for test the CreateInstanceL method. + * @since S60 5.0 + * @return Symbian OS error code. + */ + virtual TInt TestTFBCreateInstanceL( CStifItemParser& aItem ); + /** + * TestTFBDestroyInstance test method for test the DestroyInstance method. + * @since S60 5.0 + * @return Symbian OS error code. + */ + virtual TInt TestTFBDestroyInstance( CStifItemParser& aItem ); + +private:// for test the + +private: // Data + + /** + * ScreenSaver Property + */ + TInt iOldScreenSaverProperty; + + }; + +#endif // C_TESTSDKTFC_H + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/init/testsdktfc.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/init/testsdktfc.ini Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,181 @@ +# +# This is STIFTestFramework initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND +UITestingSupport= Yes +SeparateProcesses= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= testsdktfctestsdktfctestsdktfc +# Modules might have initialisation file, specified as +# IniFile= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testcombiner +TestCaseFile= c:\testframework\tctestsdktfc.cfg +[End_Module] + +#[New_Module] +#ModuleName= testscripter +#TestCaseFile= c:\testframework\ui_testsdktfc.cfg +#[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +#Load testmoduletestsdktfc, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuletestsdktfc used initialization file +#IniFile= init.txt + +#TestModuletestsdktfc used configuration file(s) +#TestCaseFile= testcases1.cfg +#TestCaseFile= testcases2.cfg +#TestCaseFile= manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/src/testsdktfc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/src/testsdktfc.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tactile_feedback_client_api +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "testsdktfc.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::CTestSDKTFC +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CTestSDKTFC::CTestSDKTFC( CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CTestSDKTFC::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KtestsdktfcLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KtestsdktfcLogFile); + } + + iLog = CStifLogger::NewL( KtestsdktfcLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + + TurnOffScreenSaver(); + } + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTestSDKTFC* CTestSDKTFC::NewL( CTestModuleIf& aTestModuleIf ) + { + CTestSDKTFC* self = new( ELeave ) CTestSDKTFC( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CTestSDKTFC::~CTestSDKTFC() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// CTestSDKTFC::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CTestSDKTFC::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L( "testsdktfc.dll" ); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion( moduleVersion, moduleName, + newVersionOfMethod ); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) CTestSDKTFC::NewL( aTestModuleIf ); + } + +// ----------------------------------------------------------------------------- +// Turn off ScreenSaver +// ----------------------------------------------------------------------------- +// +void CTestSDKTFC::TurnOffScreenSaver() + { + //TInt Get(TUid aCategory, TUint aKey, TInt &aValue); + TInt err1 = RProperty::Get( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + TInt err2 = RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + KScreenSaverAllowScreenSaver ); + RDebug::Printf( "screensaver property=%d err1=%d err2=%d\n", + iOldScreenSaverProperty, err1, err2 ); + } + +// ----------------------------------------------------------------------------- +// Restore ScreenSaver +// ----------------------------------------------------------------------------- +// +void CTestSDKTFC::RestoreScreenSaver() + { + RProperty::Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + iOldScreenSaverProperty ); + User::ResetInactivityTime(); + } + + +// End of File diff -r 000000000000 -r d54f32e146dd hapticsservices_pub/tactile_feedback_client_api/tsrc/src/testsdktfcblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapticsservices_pub/tactile_feedback_client_api/tsrc/src/testsdktfcblocks.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: tactile_feedback_client_api +* +*/ + + + +// [INCLUDE FILES] +#include +#include +#include +#include + +#include "testsdktfc.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CTestSDKTFC::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CTestSDKTFC::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "TestTFBInstance", CTestSDKTFC::TestTFBInstance ), + ENTRY( "TestTFBCreateInstanceL", CTestSDKTFC::TestTFBCreateInstanceL ), + ENTRY( "TestTFBDestroyInstance", CTestSDKTFC::TestTFBDestroyInstance ), + + // [test cases entries] + + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::TestTFCInstance +// Instance test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CTestSDKTFC::TestTFBInstance( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestsdktfc, "testsdktfc" ); + _LIT( KTestTFBInstance, "In TestTFBInstance" ); + TestModuleIf().Printf( 0, Ktestsdktfc, KTestTFBInstance ); + // Print to log file + iLog->Log( KTestTFBInstance ); + + MTouchFeedback* ptr = MTouchFeedback::Instance( ); + + STIF_ASSERT_NOT_NULL( ptr ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::TestTFCInstance +// Instance test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CTestSDKTFC::TestTFBCreateInstanceL( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestsdktfc, "testsdktfc" ); + _LIT( KTestTFBCreateInstanceL, "In TestTFBCreateInstanceL" ); + TestModuleIf().Printf( 0, Ktestsdktfc, KTestTFBCreateInstanceL ); + // Print to log file + iLog->Log( KTestTFBCreateInstanceL ); + + MTouchFeedback* mtfb = MTouchFeedback::CreateInstanceL( ); + //ptr->CreateInstanceL(); + + STIF_ASSERT_NOT_NULL( mtfb ); + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// CTestSDKTFC::TestTFCInstance +// Instance test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CTestSDKTFC::TestTFBDestroyInstance( CStifItemParser& /*aItem*/ ) + { + // Print to UI + _LIT( Ktestsdktfc, "testsdktfc" ); + _LIT( KTestTFBDestroyInstance, "In TestTFBDestroyInstance" ); + TestModuleIf().Printf( 0, Ktestsdktfc, KTestTFBDestroyInstance ); + // Print to log file + iLog->Log( KTestTFBDestroyInstance ); + + + TInt err = KErrNone; + TRAP ( err, MTouchFeedback::DestroyInstance()); + + + return err; + + } +// [End of File] diff -r 000000000000 -r d54f32e146dd layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,17 @@ + + +]> + + + + + + + + + + + + + diff -r 000000000000 -r d54f32e146dd package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d54f32e146dd sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r d54f32e146dd tacticonserver/cenrep/2001FE4D.txt Binary file tacticonserver/cenrep/2001FE4D.txt has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/cenrep/keys_tacticonserver_obsolete.xls Binary file tacticonserver/cenrep/keys_tacticonserver_obsolete.xls has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/client/bwins/tacticonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/bwins/tacticonu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + ??0RTacticon@@QAE@XZ @ 1 NONAME ; RTacticon::RTacticon(void) + ?Close@RTacticon@@QAEXXZ @ 2 NONAME ; void RTacticon::Close(void) + ?Connect@RTacticon@@QAEHXZ @ 3 NONAME ; int RTacticon::Connect(void) + ?PlayTacticon@RTacticon@@QAEXW4TTacticonType@@@Z @ 4 NONAME ; void RTacticon::PlayTacticon(enum TTacticonType) + ?StopTacticon@RTacticon@@QAEXXZ @ 5 NONAME ; void RTacticon::StopTacticon(void) + ?EnableTacticons@RTacticon@@QAEHH@Z @ 6 NONAME ; int RTacticon::EnableTacticons(int) + ?TacticonsEnabled@RTacticon@@QAEHXZ @ 7 NONAME ; int RTacticon::TacticonsEnabled(void) + diff -r 000000000000 -r d54f32e146dd tacticonserver/client/eabi/tacticonu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/eabi/tacticonu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN9RTacticon12PlayTacticonE13TTacticonType @ 1 NONAME + _ZN9RTacticon12StopTacticonEv @ 2 NONAME + _ZN9RTacticon5CloseEv @ 3 NONAME + _ZN9RTacticon7ConnectEv @ 4 NONAME + _ZN9RTacticonC1Ev @ 5 NONAME + _ZN9RTacticonC2Ev @ 6 NONAME + _ZN9RTacticon15EnableTacticonsEi @ 7 NONAME + _ZN9RTacticon16TacticonsEnabledEv @ 8 NONAME + diff -r 000000000000 -r d54f32e146dd tacticonserver/client/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Tacticon Client API +* Part of : Tacticon Server +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES +tacticon.mmp diff -r 000000000000 -r d54f32e146dd tacticonserver/client/group/tacticon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/group/tacticon.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for project tacticon client +* Part of : Tacticon Server +*/ + +#include +#include + +TARGET tacticon.dll +TARGETTYPE dll +UID 0x1000008d 0x2001FE4E + +CAPABILITY CAP_CLIENT_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tacticon.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../traces + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY featmgr.lib diff -r 000000000000 -r d54f32e146dd tacticonserver/client/src/tacticon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/src/tacticon.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client interface to tacticon server +* Part of : Tacticon Server +*/ + +#include +#include +#include "tacticontrace.h" +#include "tacticondefs.h" +#include "osttracedefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tacticonTraces.h" +#endif + +//------------------------------------------------------------ +// Starts the server +//------------------------------------------------------------ +// +TInt StartServer() + { + TRACE("Tacticon client StartServer() - Begin"); + TInt res = KErrNone; + + // DLL launch + RProcess server; + res = server.Create( KTacticonServerName, KNullDesC ); + + // Loading failed. + if ( res != KErrNone ) + { + return res; + } + + TRequestStatus status; + server.Rendezvous( status ); + + if ( status != KRequestPending ) + { + TRACE( "Tacticon server StartServer() - Rendezvous failed" ); + server.Kill( 0 ); // abort startup + server.Close(); + return KErrGeneral; + } + else + { + TRACE( "Tacticon server StartServer() - Resume" ); + server.Resume(); // Logon OK - start the server. + } + + User::WaitForRequest( status ); + server.Close(); + + TRACE("Tacticon client StartServer() - End"); + return status.Int(); + } + +// --------------------------------------------------------- +// Default constructor +// --------------------------------------------------------- +// +EXPORT_C RTacticon::RTacticon() + { + } + +// --------------------------------------------------------- +// Creates connection to tacticon server +// --------------------------------------------------------- +// +EXPORT_C TInt RTacticon::Connect() + { + TRACE("RTacticon::Connect() - Begin"); + // Check if Tacticon feature is supported or not + TRAPD( ret, FeatureManager::InitializeLibL() ); + if ( KErrNone == ret ) + { + TBool supported = + FeatureManager::FeatureSupported( KFeatureIdFfTacticons ); + FeatureManager::UnInitializeLib(); + + ret = KErrNotSupported; + if ( supported ) + { + TRACE("RTacticon::Connect() - CreateSession"); + ret = CreateSession( KTacticonServerName, Version() ); + if ( ret != KErrNone ) + { + ret = StartServer(); + if ( ret == KErrNone ) + { + TRACE2("RTacticon::Connect() - StartServer(%d)", ret); + ret = CreateSession( KTacticonServerName, Version() ); + } + } + } + else + { + TRACE("RTacticon::Connect() - Feature not supported"); + } + } + else + { + TRACE2("RTacticon::Connect() - FeatureManager init leaves (%d)", ret ); + } + TRACE2("RTacticon::Connect() - End(%d)", ret); + return ret; + } + +// --------------------------------------------------------- +// Closes connection to tacticon server +// --------------------------------------------------------- +// +EXPORT_C void RTacticon::Close() + { + if ( iHandle ) + { + RSessionBase::Close(); + } + } + +// -------------------------------------------------------------------------- +// Plays tacticon +// -------------------------------------------------------------------------- +// +EXPORT_C void RTacticon::PlayTacticon( TTacticonType aTacticonType ) + { + if ( iHandle ) + { + TRACE("RTacticon::PlayTacticon - Begin"); + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_PLAY_TACTICON_1, + "e_TACTICON_CLIENT_PLAY_TACTICON 1" ); + SendReceive( EPlayTacticon, TIpcArgs( aTacticonType ) ); + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_PLAY_TACTICON_0, + "e_TACTICON_CLIENT_PLAY_TACTICON 0" ); + TRACE("RTacticon::PlayTacticon - End"); + } + } + +// -------------------------------------------------------------------------- +// Stops playing current tacticon +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTacticon::StopTacticon() + { + if ( iHandle ) + { + TRACE("RTacticon::StopTacticon() - Begin"); + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_STOP_TACTICON_1, + "e_TACTICON_CLIENT_STOP_TACTICON 1" ); + SendReceive( EStopTacticon, TIpcArgs() ); + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_STOP_TACTICON_0, + "e_TACTICON_CLIENT_STOP_TACTICON 0" ); + TRACE("RTacticon::StopTacticon() - End"); + } + } + +// -------------------------------------------------------------------------- +// Enable/disable tacticon playback. +// +// -------------------------------------------------------------------------- +// +EXPORT_C TInt RTacticon::EnableTacticons( TBool aEnabled ) + { + TInt ret( KErrSessionClosed ); + if ( iHandle ) + { + TRACE("RTacticon::EnableTacticons() - Begin"); + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_ENABLE_TACTICON_1, + "e_TACTICON_CLIENT_ENABLE_TACTICON 1" ); + + ret = SendReceive( EEnableTacticons, TIpcArgs( aEnabled ) ); + + OstTrace0( TACTICON_PERFORMANCE, TACTICON_CLIENT_ENABLE_TACTICON_0, + "e_TACTICON_CLIENT_ENABLE_TACTICON 0" ); + TRACE("RTacticon::EnableTacticons() - End"); + } + return ret; + } + +// -------------------------------------------------------------------------- +// Returns boolean value whether tacticons are enabled or disabled. +// +// -------------------------------------------------------------------------- +// +EXPORT_C TBool RTacticon::TacticonsEnabled() + { + TBool enabled( EFalse ); + if ( iHandle ) + { + TRACE("RTacticon::TacticonsEnabled() - Begin"); + TPckg enabledBuf( enabled ); + SendReceive( ETacticonsEnabled, TIpcArgs( &enabledBuf ) ); + + TRACE("RTacticon::TacticonsEnabled() - End"); + } + return enabled; + } + +// --------------------------------------------------------- +// Returns tacticon server version +// --------------------------------------------------------- +// +TVersion RTacticon::Version() const + { + return TVersion( KTacticonServerMajor, + KTacticonServerMinor, + KTacticonServerBuild ); + } + + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/client/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tacticonserver/client/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,8 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTICON_PERFORMANCE=0x40 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_ENABLE_TACTICON_0=0x6 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_ENABLE_TACTICON_1=0x5 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_PLAY_TACTICON_0=0x2 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_PLAY_TACTICON_1=0x1 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_STOP_TACTICON_0=0x4 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_CLIENT_STOP_TACTICON_1=0x3 diff -r 000000000000 -r d54f32e146dd tacticonserver/client/traces/tacticonTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/traces/tacticonTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,20 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTICONTRACES_H__ +#define __TACTICONTRACES_H__ + +#define KOstTraceComponentID 0x2001fe4e + +#define TACTICON_CLIENT_PLAY_TACTICON_1 0x400001 +#define TACTICON_CLIENT_PLAY_TACTICON_0 0x400002 +#define TACTICON_CLIENT_STOP_TACTICON_1 0x400003 +#define TACTICON_CLIENT_STOP_TACTICON_0 0x400004 +#define TACTICON_CLIENT_ENABLE_TACTICON_1 0x400005 +#define TACTICON_CLIENT_ENABLE_TACTICON_0 0x400006 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tacticonserver/client/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/client/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,74 @@ + + 537001550 + tacticon + + 64 + TACTICON_PERFORMANCE + + e_TACTICON_CLIENT_PLAY_TACTICON 1 + 1 + TACTICON_CLIENT_PLAY_TACTICON_1 + + ../src/tacticon.cpp + 137 + RTacticon + PlayTacticon + + + + e_TACTICON_CLIENT_PLAY_TACTICON 0 + 2 + TACTICON_CLIENT_PLAY_TACTICON_0 + + ../src/tacticon.cpp + 140 + RTacticon + PlayTacticon + + + + e_TACTICON_CLIENT_STOP_TACTICON 1 + 3 + TACTICON_CLIENT_STOP_TACTICON_1 + + ../src/tacticon.cpp + 156 + RTacticon + StopTacticon + + + + e_TACTICON_CLIENT_STOP_TACTICON 0 + 4 + TACTICON_CLIENT_STOP_TACTICON_0 + + ../src/tacticon.cpp + 161 + RTacticon + StopTacticon + + + + e_TACTICON_CLIENT_ENABLE_TACTICON 1 + 5 + TACTICON_CLIENT_ENABLE_TACTICON_1 + + ../src/tacticon.cpp + 178 + RTacticon + EnableTacticons + + + + e_TACTICON_CLIENT_ENABLE_TACTICON 0 + 6 + TACTICON_CLIENT_ENABLE_TACTICON_0 + + ../src/tacticon.cpp + 183 + RTacticon + EnableTacticons + + + + diff -r 000000000000 -r d54f32e146dd tacticonserver/conf/tacticonserver.confml Binary file tacticonserver/conf/tacticonserver.confml has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/conf/tacticonserver_2001FE4D.crml Binary file tacticonserver/conf/tacticonserver_2001FE4D.crml has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Master bld.inf for Tacticon client and server. +* Part of : Tacticon Server +*/ + +#include + +PRJ_EXPORTS +../rom/tacticonserver.iby CORE_IBY_EXPORT_PATH(mw, tacticonserver.iby) +../inc/tacticondomaincrkeys.h MW_LAYER_PLATFORM_EXPORT_PATH(tacticondomaincrkeys.h) + +// Generic configuration interface for component cenrep settings +../conf/tacticonserver.confml APP_LAYER_CONFML(tacticonserver.confml) +../conf/tacticonserver_2001FE4D.crml APP_LAYER_CRML(tacticonserver_2001FE4D.crml) + +#include "../server/group/bld.inf" +#include "../client/group/bld.inf" +#include "../tacticonactionplugin/group/bld.inf" diff -r 000000000000 -r d54f32e146dd tacticonserver/inc/tacticondefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/inc/tacticondefs.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server definitions. +* Part of : Tacticon Server +*/ + +#ifndef TACTICONDEFS_H +#define TACTICONDEFS_H + +_LIT( KTacticonServerName, "TacticonServer" ); + +const TInt KTacticonServerMinor = 0; +const TInt KTacticonServerMajor = 1; +const TInt KTacticonServerBuild = 0; + +const TInt KTacticonShutdownDelay = 2000000; // 2s + +enum TTacticonCommands // Server commands. + { + EPlayTacticon, + EStopTacticon, + EEnableTacticons, + ETacticonsEnabled + }; + +#endif // TACTICONDEFS_H diff -r 000000000000 -r d54f32e146dd tacticonserver/inc/tacticondomaincrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/inc/tacticondomaincrkeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Domain level Central Repository keys for Tacticon settings. +* Part of : Tacticon Server +*/ + +#ifndef TACTICONDOMAINCRKEYS_H +#define TACTICONDOMAINCRKEYS_H + +#include + +const TUid KCRUidTacticon = {0x2001FE4D}; + +/** +* Base strength of tacticons +* +* Possible values are: +* 0-100 +* +* Default value: 50 +**/ +const TUint32 KTacticonStrength = 0x00000001; + +/** +* Full path of the IVT file, which is used to play tacticons. +* +* Possible values are: +* Valid path to IVT file. +* +* Default value: "Z:\\system\\sounds\\digital\\tacticons.ivt" +**/ +const TUint32 KTacticonIVTFile = 0x00000002; + + +#endif // TACTICONDOMAINCRKEYS_H + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/inc/tacticonprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/inc/tacticonprivatecrkeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private Central Repository keys for Tacticon setttings. +* Part of : Tacticon Server +*/ + + +#ifndef TACTICONPRIVATECRKEYS_H +#define TACTICONPRIVATECRKEYS_H + +#include "tacticondomaincrkeys.h" + +/** +* Implementation UID of the plugin, which is used to play tacticons. +* +* Possible values are: +* Implementation UID of the plugin. +* +* Default value: 537001553 (0x2001FE51) +**/ +const TUint32 KTacticonPlugin = 0x00000003; + +/** +* Boolean value to define is tacticons disabled during a phone call or not. +* +* Possible values are: +* 0, 1 +* +* Default value: 0 +**/ +const TUint32 KTacticonDuringCall = 0x00000004; + +/** +* Bitmask to define which tacticons are enabled: +* Bit 1: Call connected tacticon +* +* Possible values are: +* 0-1 +* +* Default value: 1 +**/ +const TUint32 KTacticonSet = 0x00000005; + +/** +* Defines bit 1 in KTacticonSet. +* If this bit is 1, tacticon is played when call is connected +* If this bit is 0, tacticon is not played when call is connected. +* By default this is 1. +*/ +const TInt KTacticonSetCallConnected = 0x01; // 2^0 + +/** +* Actuator type used for playing tacticons +* +* Possible values are defined in hwrmlogicalactuators.h +* +* Default value: 1 (EHWRMLogicalActuatorAny) +**/ +const TUint32 KActuatorType = 0x00000006; + + +#endif // TACTICONPRIVATECRKEYS_H + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/inc/tacticontrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/inc/tacticontrace.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File with debuf trace definitions. +* Part of : Tacticon Server +*/ + +#ifndef TACTICONTRACE_H +#define TACTICONTRACE_H + +#ifdef _DEBUG + +#include + +#define TRACE( x ) RDebug::Print( _L( x ) ) +#define TRACE2( x, y ) RDebug::Print( _L( x ), ( y ) ) +#define TRACE3( x, y, z ) RDebug::Print( _L( x ), ( y ), ( z ) ) +#define TRACE4( x, y, z, zz ) RDebug::Print( _L( x ), ( y ), ( z ), ( zz ) ) + +#else // _DEBUG + +#define TRACE( x ) +#define TRACE2( x, y ) +#define TRACE3( x, y, z ) +#define TRACE4( x, y, z, zz ) + +#endif // _DEBUG + +#endif // TACTICONTRACE_H + diff -r 000000000000 -r d54f32e146dd tacticonserver/rom/tacticonserver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/rom/tacticonserver.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: IBY file for Tacticon server. +* Part of : Tacticon Server +*/ + +#ifndef TACTICONSERVER_IBY +#define TACTICONSERVER_IBY + +#include +#include + + +// ============================================================================= +// Tacticon Client +// ============================================================================= +file=ABI_DIR\BUILD_DIR\tacticon.dll SHARED_LIB_DIR\tacticon.dll + + +#ifdef FF_TACTICONS + +// ============================================================================= +// Tacticon Server +// ============================================================================= +// if feature not included remove all server-related stuff.. +file=ABI_DIR\BUILD_DIR\tacticonserver.exe PROGRAMS_DIR\tacticonserver.exe +file=ABI_DIR\BUILD_DIR\tacticonpluginfw.dll PROGRAMS_DIR\tacticonpluginfw.dll + +data=DATAZ_\System\Sounds\Digital\tacticons.ivt System\Sounds\Digital\tacticons.ivt + +#endif // FF_TACTICONS + +#endif // TACTICONSERVER_IBY diff -r 000000000000 -r d54f32e146dd tacticonserver/server/data/Tacticons.ivt Binary file tacticonserver/server/data/Tacticons.ivt has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/server/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Tacticon server +* Part of : Tacticon Server +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../data/tacticons.ivt /epoc32/data/z/system/Sounds/Digital/tacticons.ivt +../data/tacticons.ivt /epoc32/release/winscw/udeb/Z/System/Sounds/Digital/tacticons.ivt + +PRJ_MMPFILES +../tacticonpluginfw/group/tacticonpluginfw.mmp +tacticonserver.mmp diff -r 000000000000 -r d54f32e146dd tacticonserver/server/group/tacticonserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/group/tacticonserver.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for tacticon server. +* Part of : Tacticon Server +*/ + +#include +#include + +TARGETTYPE exe +TARGET tacticonserver.exe +UID 0 0x2001FE4D + +CAPABILITY CAP_SERVER +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tacticonserver.cpp +SOURCE tacticonsession.cpp +SOURCE tacticonshutdown.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../tacticonpluginfw/inc +USERINCLUDE ../traces + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY centralrepository.lib +LIBRARY tacticonpluginfw.lib + + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/inc/tacticonserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/inc/tacticonserver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server implementation. +* Part of : Tacticon Server +*/ + +#ifndef C_TACTICONSERVER_H +#define C_TACTICONSERVER_H + +#include +#include + +#include + +#include "tacticonplayer.h" +#include "tacticonprivatecrkeys.h" +#include "tacticondefs.h" + +class CRepository; +class CTacticonShutdown; + +/** Total number of ranges */ +const TUint KTacticonRangeCount = 1; + +/** Definition of the ranges of IPC numbers */ +const TInt KTacticonRanges[KTacticonRangeCount] = + { + 0, + }; + +/** Policy to implement for each of the above ranges */ +const TUint8 KTacticonElementsIndex[KTacticonRangeCount] = + { + 0, + }; + +const CPolicyServer::TPolicyElement KTacticonPolicyElements[] = + { + _INIT_SECURITY_POLICY_C2(ECapability_None, + ECapability_None), + CPolicyServer::EFailClient + }; + +/** Package all the above together into a policy */ +const CPolicyServer::TPolicy KTacticonPolicy = + { + CPolicyServer::EAlwaysPass, // all attempts should pass + KTacticonRangeCount, // number of ranges + KTacticonRanges, // ranges array + KTacticonElementsIndex, // elements<->ranges index + KTacticonPolicyElements, // array of elements + }; + +/** +* A server class to initialize server. +* @lib tacticonserver.lib +* @since S60 5.2 +*/ +class CTacticonServer : public CPolicyServer + { +public: + /** + * 2-phased constructor. + */ + static CTacticonServer* NewLC(); + + /** + * C++ destructor. + */ + virtual ~CTacticonServer(); + + +public: + /** + * From CServer2, creates a new session. + * @since S60 5.2 + * @param aVersion, Tacticon server version + * @param aMessage, a message from client + */ + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + +public: + /** + * Increase session count. + * @since S60 5.2 + */ + void AddSession(); + + /** + * Decrease session count, close server if count is zero. + * @since S60 5.2 + */ + void RemoveSession(); + +public: + /** + * Plays tacticon according to aTacticonType + * @since S60 5.2 + * @param aTacticonType, Tacticon type to be played + */ + void PlayTacticon( TTacticonType aTacticonType ); + + /** + * Stops playing tacticon + * @since S60 5.2 + */ + void StopTacticon(); + + /** + * Sets tacticons enabled/disabled. + * @since S60 5.2 + */ + void EnableTacticons( TBool aEnabled ); + + /** + * Returns boolean value whether tacticons are enabled or disabled. + * @since S60 5.2 + */ + TBool TacticonsEnabled(); + +private: + /** + * C++ constructor. + */ + CTacticonServer(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + +private: + /** + * Counter of opened client sessions. + */ + TInt iSessionCount; + + /** + * Player plugin. + * Own. + */ + CTacticonPlayer* iPlayer; + + /** + * Access to settings. + * Own. + */ + CRepository* iRepository; + + /** + * Timer for server shutdown + * Own. + */ + CTacticonShutdown* iShutdown; + + /** + * + */ + TBool iTacticonsEnabled; + + }; + + +#endif // C_TACTICONSERVER_H + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/inc/tacticonsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/inc/tacticonsession.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server session implementation. +* Part of : Tacticon Server +*/ + +#ifndef C_TACTICONSESSION_H +#define C_TACTICONSESSION_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CTacticonServer; + +/** +* A session class of Tacticon server. +* +* @since S60 5.2 +*/ + +class CTacticonSession : public CSession2 + { +public: + /** + * C++ constructor. + */ + CTacticonSession(); + + /** + * Passes the request forward to DispatchMessageL. + * @param aMessage, a message from client. + */ + void ServiceL( const RMessage2& aMessage ); + + /** + * Handles the request from client. + * @param aMessage, a message from client. + */ + void DispatchMessageL( const RMessage2& aMessage ); + + /** + * Adds session to server's counter. + */ + void CreateL(); + +private: + /** + * Sets tacticons enabled/disabled. + */ + void EnableTacticonsL( const RMessage2& aMessage ); + + /** + * Returns boolean value whether tacticons are enabled or disabled. + */ + void TacticonsEnabledL( const RMessage2& aMessage ); + +private: + + /** + * C++ destructor. + */ + virtual ~CTacticonSession(); + + /* + * Reference to Tacticon Server. Ownership is not transferred. + */ + CTacticonServer& Server(); + + }; + +#endif // C_TACTICONSESSION_H + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/inc/tacticonshutdown.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/inc/tacticonshutdown.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server shutdown timer. +* Part of : Tacticon Server +*/ + +#ifndef C_TACTICONSHUTDOWN_H +#define C_TACTICONSHUTDOWN_H + +#include + +/** + * Tacticon server shutdown timer. + */ +class CTacticonShutdown : public CTimer + { +public: + + /** + * Two phased constructor. + * + * @return Created instance of the shutdown timer. + */ + static CTacticonShutdown* NewL(); + + /** + * Destructor. + */ + virtual ~CTacticonShutdown(); + + /** + * Starts the timer. + */ + void Start(); + +private: + + /** + * C++ constructor. + */ + CTacticonShutdown(); + + /** + * Second phase construction. + */ + void ConstructL(); + + /** + * From base class CActive. + * @see CActive. + * + * Executed when the timer expires; Shuts down + * the server by closing the active scheduler. + */ + void RunL(); + }; + +#endif // C_TACTICONSHUTDOWN_H + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/server/src/tacticonserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/src/tacticonserver.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server implementation. +* Part of : Tacticon Server +*/ + +#include +#include +#include +#include +#include "tacticonserver.h" +#include "tacticonsession.h" +#include "tacticondefs.h" +#include "tacticonshutdown.h" +#include "tacticontrace.h" +#include "osttracedefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tacticonservertraces.h" +#endif + +// -------------------------------------------------------------------------- +// RunServerL +// Initialize and run the server. +// -------------------------------------------------------------------------- +// +static void RunServerL() + { + TRACE( "Tacticon server RunServer() - Begin" ); + User::LeaveIfError( RThread().RenameMe( KTacticonServerName ) ); + + CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + CTacticonServer* server = CTacticonServer::NewLC(); + + RProcess::Rendezvous( KErrNone ); + + CActiveScheduler::Start(); + + // Cleanup server and scheduler + CleanupStack::PopAndDestroy(server); + CleanupStack::PopAndDestroy(scheduler); + TRACE("Tacticon server RunServer() - End"); + } + +// -------------------------------------------------------------------------- +// E32Main +// Server process entry-point. +// -------------------------------------------------------------------------- +// +TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt ret( KErrNoMemory ); + if( cleanup ) + { + TRAP( ret, RunServerL() ); + delete cleanup; + } + __UHEAP_MARKEND; + return ret; + } + +// -------------------------------------------------------------------------- +// CTacticonServer::NewL +// 2-phased constructor. +// -------------------------------------------------------------------------- +// +CTacticonServer* CTacticonServer::NewLC() + { + TRACE( "CTacticonServer::NewLC - Begin" ); + CTacticonServer* self = new (ELeave) CTacticonServer(); + CleanupStack::PushL(self); + self->ConstructL(); + TRACE("CTacticonServer::NewLC - End"); + return self; + } + +// -------------------------------------------------------------------------- +// CTacticonServer::CTacticonServer() +// C++ constructor. +// -------------------------------------------------------------------------- +// +CTacticonServer::CTacticonServer() + : CPolicyServer( EPriorityNormal, + KTacticonPolicy, + ESharableSessions ), + iTacticonsEnabled( ETrue ) + { + } + +// -------------------------------------------------------------------------- +// CTacticonServer::ConstructL +// 2nd phase constructor. +// -------------------------------------------------------------------------- +// +void CTacticonServer::ConstructL() + { + TRACE( "CTacticonServer::ConstructL - Begin" ); + StartL( KTacticonServerName); + TRACE( "CTacticonServer::ConstructL - Server started" ); + iRepository = CRepository::NewL( KCRUidTacticon ); + + TInt pluginUid(0); + User::LeaveIfError( iRepository->Get( KTacticonPlugin, pluginUid ) ); + TRACE2( "CTacticonServer::ConstructL - got pluginUid: %d", pluginUid ); + + TRACE("CTacticonServer::ConstructL - creating player"); + // The server is instantiated during boot time. To enable phone to boot up + // even if player instatiation fails, trap its possible failure. + TRAPD(err, iPlayer = CTacticonPlayer::NewL( TUid::Uid(pluginUid), *iRepository ) ); + if ( err ) + { + TRACE2( "CTacticonServer::ConstructL - Creating Player failed with code %d", err ); + iPlayer = NULL; // to ensure that player pointer is not broken + } + + TRACE( "CTacticonServer::ConstructL - Creating shutdown instance" ); + iShutdown = CTacticonShutdown::NewL(); + TRACE( "CTacticonServer::ConstructL - End" ); + } + +// -------------------------------------------------------------------------- +// CTacticonServer::CTacticonServer() +// C++ destructor. +// -------------------------------------------------------------------------- +// +CTacticonServer::~CTacticonServer() + { + delete iPlayer; + delete iRepository; + delete iShutdown; + REComSession::FinalClose(); + } + +// -------------------------------------------------------------------------- +// CTacticonServer::NewSessionL +// from CServer2, creates a new session. +// -------------------------------------------------------------------------- +// +CSession2* CTacticonServer::NewSessionL( const TVersion& aVersion, + const RMessage2& /*aMessage*/ ) const + { + TRACE("CTacticonServer::NewSessionL - Begin"); + TVersion version( KTacticonServerMajor, + KTacticonServerMinor, KTacticonServerBuild ); + + TBool supported = User::QueryVersionSupported( version, aVersion ); + + if( !supported ) + { + TRACE("CTacticonServer::NewSessionL - Version not supported"); + User::Leave( KErrNotSupported ); + } + + CTacticonSession* session = new (ELeave) CTacticonSession(); + TRACE("CTacticonServer::NewSessionL - End"); + return session; + } + +// -------------------------------------------------------------------------- +// CTacticonServer::AddSession +// -------------------------------------------------------------------------- +// +void CTacticonServer::AddSession() + { + TRACE("CTacticonServer::AddSession - Begin"); + iSessionCount++; + iShutdown->Cancel(); + TRACE("CTacticonServer::AddSession - End"); + } + +// -------------------------------------------------------------------------- +// CTacticonServer::RemoveSession +// -------------------------------------------------------------------------- +// +void CTacticonServer::RemoveSession() + { + TRACE( "CTacticonServer::RemoveSession - Begin" ); + iSessionCount--; + + // Start the shutdown timer there are no more sessions + if ( !iSessionCount && !iShutdown->IsActive() ) + { + iShutdown->Start(); + } + TRACE( "CTacticonServer::RemoveSession - End" ); + } + +// -------------------------------------------------------------------------- +// CTacticonServer::PlayTacticon +// -------------------------------------------------------------------------- +// +void CTacticonServer::PlayTacticon( TTacticonType aTacticonType ) + { + if ( iPlayer && iTacticonsEnabled ) + { + OstTrace0( TACTICON_PERFORMANCE, TACTICON_SERVER_PLAY_TACTICON_1, + "e_TACTICON_SERVER_PLAY_TACTICON 1" ); + + iPlayer->PlayTacticon( aTacticonType ); + + OstTrace0( TACTICON_PERFORMANCE, TACTICON_SERVER_PLAY_TACTICON_0, + "e_TACTICON_SERVER_PLAY_TACTICON 0" ); + } + else + { + TRACE("CTacticonServer::PlayTacticon - Player not available"); + } + } + +// -------------------------------------------------------------------------- +// CTacticonServer::StopTacticon +// -------------------------------------------------------------------------- +// +void CTacticonServer::StopTacticon() + { + if ( iPlayer ) + { + OstTrace0( TACTICON_PERFORMANCE, TACTICON_SERVER_STOP_TACTICON_1, + "e_TACTICON_SERVER_STOP_TACTICON 1" ); + + iPlayer->StopTacticon(); + + OstTrace0( TACTICON_PERFORMANCE, TACTICON_SERVER_STOP_TACTICON_0, + "e_TACTICON_SERVER_STOP_TACTICON 0" ); + } + } + +// -------------------------------------------------------------------------- +// CTacticonServer::EnableTacticons +// -------------------------------------------------------------------------- +// +void CTacticonServer::EnableTacticons( TBool aEnabled ) + { + iTacticonsEnabled = aEnabled; + } + +// -------------------------------------------------------------------------- +// CTacticonServer::EnableTacticons +// -------------------------------------------------------------------------- +// +TBool CTacticonServer::TacticonsEnabled() + { + return iTacticonsEnabled; + } + +// End of file diff -r 000000000000 -r d54f32e146dd tacticonserver/server/src/tacticonsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/src/tacticonsession.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server session implementation. +* Part of : Tacticon Server +*/ + +#include "tacticonsession.h" +#include "tacticonserver.h" +#include "tacticondefs.h" +#include "tacticontrace.h" + +// -------------------------------------------------------------------------- +// CTacticonSession::CTacticonSession +// C++ constructor. +// -------------------------------------------------------------------------- +// +CTacticonSession::CTacticonSession() + { + } + +// -------------------------------------------------------------------------- +// CTacticonSession::CTacticonSession +// C++ destructor. +// -------------------------------------------------------------------------- +// +CTacticonSession::~CTacticonSession() + { + Server().RemoveSession(); + } + +// -------------------------------------------------------------------------- +// CTacticonSession::ServiceL +// From CSession2, passes the request forward to DispatchMessageL. +// -------------------------------------------------------------------------- +// +void CTacticonSession::ServiceL( const RMessage2& aMessage ) + { + TRACE( "CTacticonSession::ServiceL - Begin" ); + TRAPD( err,DispatchMessageL( aMessage ) ); + aMessage.Complete( err ); + + TRACE( "CTacticonSession::ServiceL - End" ); + } + +// -------------------------------------------------------------------------- +// CTacticonSession::DispatchMessageL +// Handles the request from client. +// -------------------------------------------------------------------------- +// +void CTacticonSession::DispatchMessageL( const RMessage2& aMessage ) + { + TRACE( "CTacticonSession::DispatchMessageL - Begin" ); + switch( aMessage.Function() ) + { + case EPlayTacticon: + Server().PlayTacticon( ( TTacticonType )aMessage.Int0() ); + break; + case EStopTacticon: + Server().StopTacticon(); + break; + case EEnableTacticons: + EnableTacticonsL( aMessage ); + break; + case ETacticonsEnabled: + TacticonsEnabledL( aMessage ); + break; + default: + User::Leave( KErrArgument ); + break; + } + TRACE( "CTacticonSession::DispatchMessageL - End" ); + } + +// -------------------------------------------------------------------------- +// CTacticonSession::EnableTacticonsL +// Set tacticons enabled/disabled. +// ECapabilityWriteDeviceData capability is needed to use this function. +// -------------------------------------------------------------------------- +// +void CTacticonSession::EnableTacticonsL( const RMessage2& aMessage ) + { + if ( aMessage.HasCapability( ECapabilityWriteDeviceData ) ) + { + Server().EnableTacticons( aMessage.Int0() ); + } + else + { + User::Leave( KErrPermissionDenied ); + } + } + +// -------------------------------------------------------------------------- +// CTacticonSession::TacticonsEnabled +// Returns boolean value whether tacticons are enabled or disabled. +// -------------------------------------------------------------------------- +// +void CTacticonSession::TacticonsEnabledL( const RMessage2& aMessage ) + { + TBool enabled = Server().TacticonsEnabled(); + TPckg enabledBuf( enabled ); + aMessage.WriteL( 0, enabledBuf ); + } + +// -------------------------------------------------------------------------- +// CTacticonSession::CreateL +// From CSession2, used to increase server's session count. +// -------------------------------------------------------------------------- +// +void CTacticonSession::CreateL() + { + TRACE( "CTacticonSession::CreateL - Begin" ); + Server().AddSession(); + TRACE( "CTacticonSession::CreateL - End" ); + } + +// -------------------------------------------------------------------------- +// CTacticonSession::Server +// Reference to server. +// -------------------------------------------------------------------------- +// +CTacticonServer& CTacticonSession::Server() + { + return *static_cast + ( const_cast( CSession2::Server() ) ); + } + + +// End of file diff -r 000000000000 -r d54f32e146dd tacticonserver/server/src/tacticonshutdown.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/src/tacticonshutdown.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon server shutdown timer. +* Part of : Tacticon Server +*/ + +#include "tacticonshutdown.h" +#include "tacticondefs.h" + +// --------------------------------------------------------------------------- +// Two phased constructor. +// --------------------------------------------------------------------------- +// +CTacticonShutdown* CTacticonShutdown::NewL() + { + CTacticonShutdown* self = new ( ELeave ) CTacticonShutdown(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTacticonShutdown::~CTacticonShutdown() + { + } + +// --------------------------------------------------------------------------- +// Activates this timer. +// --------------------------------------------------------------------------- +// +void CTacticonShutdown::Start() + { + After( KTacticonShutdownDelay ); + } + +// --------------------------------------------------------------------------- +// Constructor of the shutdown timer. +// --------------------------------------------------------------------------- +// +CTacticonShutdown::CTacticonShutdown() + : CTimer( EPriorityStandard ) + { + // add this active object to the active scheduler + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// Second phase construction. +// --------------------------------------------------------------------------- +// +void CTacticonShutdown::ConstructL() + { + CTimer::ConstructL(); + } + +// --------------------------------------------------------------------------- +// Shuts down tacticon server by stopping the active scheduler. +// --------------------------------------------------------------------------- +// +void CTacticonShutdown::RunL() + { + CActiveScheduler::Stop(); + } + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/bwins/tacticonpluginfwu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/bwins/tacticonpluginfwu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,5 @@ +EXPORTS + ??1CTacticonPlayer@@UAE@XZ @ 1 NONAME ; CTacticonPlayer::~CTacticonPlayer(void) + ?ListImplementationsL@CTacticonPlayer@@SAXAAV?$RPointerArray@VCImplementationInformation@@@@@Z @ 2 NONAME ; void CTacticonPlayer::ListImplementationsL(class RPointerArray &) + ?NewL@CTacticonPlayer@@SAPAV1@VTUid@@AAVCRepository@@@Z @ 3 NONAME ; class CTacticonPlayer * CTacticonPlayer::NewL(class TUid, class CRepository &) + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/eabi/tacticonpluginfwu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/eabi/tacticonpluginfwu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN15CTacticonPlayer20ListImplementationsLER13RPointerArrayI26CImplementationInformationE @ 1 NONAME + _ZN15CTacticonPlayer4NewLE4TUidR11CRepository @ 2 NONAME + _ZN15CTacticonPlayerD0Ev @ 3 NONAME + _ZN15CTacticonPlayerD1Ev @ 4 NONAME + _ZN15CTacticonPlayerD2Ev @ 5 NONAME + _ZTI15CTacticonPlayer @ 6 NONAME ; ## + _ZTV15CTacticonPlayer @ 7 NONAME ; ## + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Tacticon plugin FW. +* Part of : Tacticon Server +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +tacticonpluginfw.mmp diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/group/tacticonpluginfw.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/group/tacticonpluginfw.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Tacticon plugin framework +* implementation. +* Part of : Tacticon Server +*/ + +#include +#include + +TARGET tacticonpluginfw.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000B4F3 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tacticonplayer.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +#ifdef RD_SYMBIAN_TRACES +SYSTEMINCLUDE /epoc32/include/internal/symbiantraces +#endif + +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY ecom.lib + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/inc/tacticonplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/inc/tacticonplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon player plugin interface. +* Part of : Tacticon Server +*/ + +#ifndef C_TACTICONPLAYER_H +#define C_TACTICONPLAYER_H + +#include +#include + +#include + +class CRepository; + +/** + * Tacticon player ECom plugin interface. + * + * @since S60 5.2 + */ +class CTacticonPlayer : public CBase + { +public: + /** + * Instantiates an object of this type. + * + * @since S60 5.2 + * @param aImplementationUid - Implementation uid of the plugin + * to be created. + * @param aRepository - Reference to Central Repository, which is + * used for reading Tacticon settings. + * CR Keys for Tacticons are defined in + * tacticondomaincrkeys.h + * + * @return Instance of tacticon player plugin. + */ + IMPORT_C static CTacticonPlayer* NewL( TUid aImplementationUid, + CRepository& aRepository ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CTacticonPlayer(); + + /** + * Returns a list of available implementations for this + * interface. + * + * @since S60 5.2 + * @param aImplInfoArray - Implementation information array of all + * available implementations. + */ + IMPORT_C static void ListImplementationsL( RImplInfoPtrArray& aImplInfoArray ); + +public: + /** + * Plays tacticon according to aTacticonType + * @since S60 5.2 + * @param aTacticonType, Tacticon type to be played + */ + virtual void PlayTacticon( TTacticonType aTacticonType ) = 0; + + /** + * Stops playing tacticon + * @since S60 5.2 + */ + virtual void StopTacticon() = 0; + +private: + + // Unique instance identifier key. + TUid iDtor_ID_Key; + + }; + +#endif // C_TACTICONPLAYER_H diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/inc/tacticonpluginfwuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/inc/tacticonpluginfwuids.hrh Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tacticon player plugin interface UIDs. +* Part of : Tacticon Server +*/ + + +#define ETacticonPlayerIFUID 0x2001FE50 \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/src/tacticonplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/src/tacticonplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface class for tacticon players. +* Part of : Tacticon Server +*/ + +#include "tacticonplayer.h" +#include "tacticonpluginfwuids.hrh" + +const TUid KTacticonPlayerIFUid = { ETacticonPlayerIFUID }; + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C CTacticonPlayer* CTacticonPlayer::NewL( TUid aImplementationUid, + CRepository& aRepository ) + { + return ( CTacticonPlayer* ) + REComSession::CreateImplementationL( aImplementationUid, + _FOFF(CTacticonPlayer, iDtor_ID_Key ), &aRepository ); + } + +// --------------------------------------------------------------------------- +// Lists the available plugin implementations for this interface. +// --------------------------------------------------------------------------- +// +EXPORT_C void CTacticonPlayer::ListImplementationsL( RImplInfoPtrArray& aImplInfoArray ) + { + REComSession::ListImplementationsL( KTacticonPlayerIFUid, + aImplInfoArray ); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CTacticonPlayer::~CTacticonPlayer() + { + REComSession::DestroyedImplementation( iDtor_ID_Key ); + } + +// End of file. diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/cenrep/2001FE52.txt Binary file tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/cenrep/2001FE52.txt has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/cenrep/keys_tacticonhapticsplugin_obsolete.xls Binary file tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/cenrep/keys_tacticonhapticsplugin_obsolete.xls has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/conf/tacticonhapticsplugin.confml Binary file tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/conf/tacticonhapticsplugin.confml has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/conf/tacticonhapticsplugin_2001FE52.crml Binary file tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/conf/tacticonhapticsplugin_2001FE52.crml has changed diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/data/2001FE52.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/data/2001FE52.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ECom registration file for Tacticon Haptics player plugin. +* Part of : Tacticon Server +*/ + +#include +#include "tacticonpluginfwuids.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2001FE52; + interfaces = + { + INTERFACE_INFO + { + interface_uid = ETacticonPlayerIFUID; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001FE51; + version_no = 1; + display_name = "Tacticon Haptics Player"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + +// End of file \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for tacticon haptics plugin. +* Part of : Tacticon Server +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// IBY file +../rom/tacticonhapticsplugin.iby CORE_IBY_EXPORT_PATH(mw, tacticonhapticsplugin.iby) + +// Generic configuration interface for component cenrep settings +../conf/tacticonhapticsplugin.confml APP_LAYER_CONFML(tacticonhapticsplugin.confml) +../conf/tacticonhapticsplugin_2001FE52.crml APP_LAYER_CRML(tacticonhapticsplugin_2001FE52.crml) + +PRJ_MMPFILES +tacticonhapticsplugin.mmp diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/group/tacticonhapticsplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/group/tacticonhapticsplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Haptics tacticon plugin project definition file. +* Part of: Tacticon Server +*/ + +#include +#include + +TARGET tacticonhapticsplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001FE52 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tacticonhapticsplayer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../traces + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 2001FE52.rss +TARGETPATH ECOM_RESOURCE_DIR +TARGET tacticonhapticsplugin.rsc +END + + +#ifdef RD_SYMBIAN_TRACES +SYSTEMINCLUDE /epoc32/include/internal/symbiantraces +#endif + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY hwrmhapticsclient.lib +LIBRARY tacticonpluginfw.lib diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/inc/tacticonhapticsplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/inc/tacticonhapticsplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing haptics tacticon. +* Part of: Tacticon Server +*/ + +#ifndef C_TACTICONHAPTICSPLAYER_H +#define C_TACTICONHAPTICSPLAYER_H + +#include +#include + +#include "tacticonprivatecrkeys.h" +#include "tacticonplayer.h" + +class CHWRMHaptics; + +/** + * Ecom plugin for playing haptics tacticons. + * + * @lib tactilehapticsplugin.lib + * @since S60 5.2 + */ + +NONSHARABLE_CLASS( CTacticonHapticsPlayer ): public CTacticonPlayer, + public MCenRepNotifyHandlerCallback + { +public: + /** + * 2-phased constructor. + * @return An instance of haptics tacticon player. + */ + static CTacticonHapticsPlayer* NewL( CRepository& aRepository ); + + /** + * Destructor. + */ + virtual ~CTacticonHapticsPlayer(); + + // from base class CTacticonPlayer + + /** + * Plays tacticon according to aTacticonType + * @since S60 5.2 + * @param aTacticonType, Tacticon type to be played + */ + void PlayTacticon( TTacticonType aTacticonType ); + + /** + * Stops playing tacticon + * @since S60 5.2 + */ + void StopTacticon(); + +private: // From MCenRepNotifyHandlerCallback. + + void HandleNotifyGeneric( TUint32 aId ); + +private: + /** + * Reads IVT data from file to buffer. + */ + HBufC8* IVTBufAllocL( const TDesC& aFileName ); + + /** + * Change effect file in haptics instance. + */ + void ChangeIVTFileL( const TDesC& aFileName ); + + /** + * Handle Central Repository settings changes. + */ + void DoHandleNotifyGenericL( TUint32 aId ); +private: + + /** + * Constructor. + */ + CTacticonHapticsPlayer( CRepository& aRepository ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + +private: // data + + /** + * Access to vibra functionality + * Own. + */ + CHWRMHaptics* iHaptics; + + /** + * Handle of effect file, which is loaded to haptics instance. + */ + TInt iIVTHandle; + + /** + * Haptics strength. + */ + TInt iStrength; + + /** + * Access to settings. + * Not own. + */ + CRepository& iRepository; + + /** + * Utility for listening to changes in configurable parameters. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + }; + + +#endif // C_TACTICONHAPTICSPLAYER_H diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/inc/tacticonhapticsplayerprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/inc/tacticonhapticsplayerprivatecrkeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private Central Repository keys for Tacticon Haptics Player. +* Part of : Tacticon Server +*/ + + +#ifndef TACTICONHAPTICSPLAYERPRIVATECRKEYS_H +#define TACTICONHAPTICSPLAYERPRIVATECRKEYS_H + +const TUid KCRUidTacticonHapticsPlayer = {0x2001FE52}; + +/** +* Actuator type used for playing tacticons +* +* Possible values are defined in hwrmlogicalactuators.h +* +* Default value: 1 (EHWRMLogicalActuatorAny) +**/ +const TUint32 KActuatorType = 0x00000001; + + +#endif // TACTICONHAPTICSPLAYERPRIVATECRKEYS_H + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/rom/tacticonhapticsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/rom/tacticonhapticsplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the IBY file for Tacticon Haptics plugin. +* Part of: Tacticon Server +*/ + +#ifndef TACTICONHAPTICSPLUGIN_IBY +#define TACTICONHAPTICSPLUGIN_IBY +#include + + + +#ifdef FF_TACTICONS + +#include + +ECOM_PLUGIN(tacticonhapticsplugin.dll,tacticonhapticsplugin.rsc) + +#endif // FF_TACTICONS + +#endif // TACTICONHAPTICSPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/src/tacticonhapticsplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/src/tacticonhapticsplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing haptics tacticon. +* Part of: Tacticon Server +*/ + +#include +#include +#include +#include + +#include "tacticonhapticsplayer.h" +#include "tacticonprivatecrkeys.h" +#include "tacticontrace.h" +#include "osttracedefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tacticonhapticsplayertraces.h" +#endif + + +// Tacticons +_LIT8( KPositiveTacticon, "PositiveTacticon"); +_LIT8( KNegativeTacticon, "NegativeTacticon"); +_LIT8( KNeutralTacticon, "NeutralTacticon" ); + + +// max length of tacticon names defined above +const TInt KTacticonNameMaxLen = 128; + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTacticonHapticsPlayer::CTacticonHapticsPlayer( CRepository& aRepository ) : + iRepository(aRepository) + { + + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::ConstructL() + { + TRACE( "CTacticonHapticsPlayer::ConstructL - Begin" ); + iHaptics = CHWRMHaptics::NewL( NULL, NULL ); + + TUint32 suppMask( 0 ); + User::LeaveIfError( iHaptics->SupportedActuators( suppMask ) ); + + CRepository* playerRepository = CRepository::NewL( KCRUidTacticon ); + CleanupStack::PushL( playerRepository ); + TInt actuatorType( 0 ); + playerRepository->Get( KActuatorType, actuatorType ); + CleanupStack::PopAndDestroy( playerRepository ); + TRACE2( "CTacticonHapticsPlayer::ConstructL - ActuatorType: %d", actuatorType ); + if ( actuatorType & suppMask ) + { + // supported actuator, use this + iHaptics->OpenActuatorL( ( THWRMLogicalActuators )actuatorType ); + } + else + { + TRACE3( "CTacticonHapticsPlayer::ConstructL - ActuatorType is not supported: %d/%d", + actuatorType, + suppMask ); + // suggested actuator is not supported, use default one + iHaptics->OpenActuatorL( EHWRMLogicalActuatorAny ); + } + + User::LeaveIfError( iHaptics->SetDeviceProperty( + CHWRMHaptics::EHWRMHapticsLicensekey, + KNullDesC8() ) ); + TInt strength( 0 ); + User::LeaveIfError( iRepository.Get( KTacticonStrength, strength ) ); + iStrength = strength * 100; // strength is in percents + + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + iStrength ); + TRACE2( "CTacticonHapticsPlayer::ConstructL - Set strength: %d", iStrength ); + + TFileName ivtFile; + User::LeaveIfError( iRepository.Get( KTacticonIVTFile, ivtFile ) ); + TRACE2( "CTacticonHapticsPlayer::ConstructL - Loading IVT file: %S", &ivtFile ); + + HBufC8* ivtBuf = IVTBufAllocL( ivtFile ); + CleanupStack::PushL( ivtBuf ); + User::LeaveIfError( iHaptics->LoadEffectData( *ivtBuf, iIVTHandle ) ); + CleanupStack::PopAndDestroy( ivtBuf ); + + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, iRepository ); + iCenRepNotifier->StartListeningL(); + + TRACE( "CTacticonHapticsPlayer::ConstructL - End" ); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTacticonHapticsPlayer* CTacticonHapticsPlayer::NewL( CRepository& aRepository ) + { + CTacticonHapticsPlayer* self = + new ( ELeave ) CTacticonHapticsPlayer( aRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTacticonHapticsPlayer::~CTacticonHapticsPlayer() + { + delete iCenRepNotifier; + delete iHaptics; + } + +// --------------------------------------------------------------------------- +// Load IVT file. +// --------------------------------------------------------------------------- +// +HBufC8* CTacticonHapticsPlayer::IVTBufAllocL( const TDesC& aFileName ) + { + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + RFile file; + User::LeaveIfError( file.Open( fs, aFileName, EFileRead ) ); + CleanupClosePushL( file ); + + TInt fileSize( 0 ); + file.Size( fileSize ); + + HBufC8* ivtFileBuf = HBufC8::NewLC( fileSize ); + TPtr8 dataBufPtr = ivtFileBuf->Des(); + + User::LeaveIfError( file.Read( dataBufPtr ) ); + + CleanupStack::Pop( ivtFileBuf ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + return ivtFileBuf; + } + +// --------------------------------------------------------------------------- +// Check if there's a change in tacticon settings and set new values if needed. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::DoHandleNotifyGenericL( TUint32 aId ) + { + switch ( aId ) + { + case KTacticonStrength: + { + // Strength value in settings is multiplied by 100 to scale value + // suitable for haptics. + TInt strength(0); + iRepository.Get( KTacticonStrength, strength ); + + iStrength = strength * 100; + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + iStrength ); + } + break; + case KTacticonIVTFile: + { + TFileName ivtFile; + iRepository.Get( KTacticonIVTFile, ivtFile ); + ChangeIVTFileL( ivtFile ); + } + break; + default: + break; + } + } + +// --------------------------------------------------------------------------- +// From MCenRepNotifyHandlerCallback. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::HandleNotifyGeneric( TUint32 aId ) + { + TRAP_IGNORE( DoHandleNotifyGenericL( aId ) ); + } + +// --------------------------------------------------------------------------- +// Load new effect file. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::ChangeIVTFileL( const TDesC& aFileName ) + { + iHaptics->DeleteEffectData( iIVTHandle ); + + HBufC8* ivtBuf = IVTBufAllocL( aFileName ); + + iHaptics->LoadEffectData( *ivtBuf, iIVTHandle ); + + delete ivtBuf; + } + +// --------------------------------------------------------------------------- +// Play tacticon. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::PlayTacticon( TTacticonType aTacticon ) + { + TRACE2( "CTacticonHapticsPlayer::PlayTacticon(%d) - Begin", aTacticon ); + + TBuf8 name; + switch( aTacticon ) + { + case EPositiveTacticon: + name = KPositiveTacticon; + break; + case ENegativeTacticon: + name = KNegativeTacticon; + break; + case ENeutralTacticon: + name = KNeutralTacticon; + break; + default: + return; + } + TInt effectIndex(0); + iHaptics->GetEffectIndexFromName( iIVTHandle, name, effectIndex ); + + OstTrace1( TACTICON_PERFORMANCE, TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_1, + "e_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON 1 0x%x", aTacticon ); + + TInt effectHandle(0); + iHaptics->PlayEffect( iIVTHandle, effectIndex, effectHandle ); + + OstTrace1( TACTICON_PERFORMANCE, TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_0, + "e_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON 0 0x%x", aTacticon ); + + TRACE( "CTacticonHapticsPlayer::PlayTacticon(%d) - End" ); + } + +// --------------------------------------------------------------------------- +// Stop playing tacticon. +// --------------------------------------------------------------------------- +// +void CTacticonHapticsPlayer::StopTacticon() + { + OstTrace0( TACTICON_PERFORMANCE, TACTICON_HAPTICS_PLAYER_STOP_TACTICON_1, + "e_TACTICON_HAPTICS_PLAYER_STOP_TACTICON 1" ); + + iHaptics->StopAllPlayingEffects(); + + OstTrace0( TACTICON_PERFORMANCE, TACTICON_HAPTICS_PLAYER_STOP_TACTICON_0, + "e_TACTICON_HAPTICS_PLAYER_STOP_TACTICON 0" ); + } + +//--------------------------------------------------------------------------- +// ImplementationTable[] +// +//--------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001FE51, CTacticonHapticsPlayer::NewL ) + }; + +//--------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// +//--------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of file diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,6 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTICON_PERFORMANCE=0x40 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_0=0x2 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_1=0x1 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_HAPTICS_PLAYER_STOP_TACTICON_0=0x4 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_HAPTICS_PLAYER_STOP_TACTICON_1=0x3 diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/tacticonhapticsplayerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/tacticonhapticsplayerTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTICONHAPTICSPLAYERTRACES_H__ +#define __TACTICONHAPTICSPLAYERTRACES_H__ + +#define KOstTraceComponentID 0x2001fe52 + +#define TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_1 0x400001 +#define TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_0 0x400002 +#define TACTICON_HAPTICS_PLAYER_STOP_TACTICON_1 0x400003 +#define TACTICON_HAPTICS_PLAYER_STOP_TACTICON_0 0x400004 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/tacticonpluginfw/tacticonhapticsplugin/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,62 @@ + + 537001554 + tacticonhapticsplugin + + 64 + TACTICON_PERFORMANCE + + e_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON 1 0x%x + 1 + TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_1 + + hex32 + 1 + aTacticon + + + ../src/tacticonhapticsplayer.cpp + 243 + CTacticonHapticsPlayer + PlayTacticon + + + + e_TACTICON_HAPTICS_PLAYER_PLAY_TACTICON 0 0x%x + 2 + TACTICON_HAPTICS_PLAYER_PLAY_TACTICON_0 + + hex32 + 1 + aTacticon + + + ../src/tacticonhapticsplayer.cpp + 249 + CTacticonHapticsPlayer + PlayTacticon + + + + e_TACTICON_HAPTICS_PLAYER_STOP_TACTICON 1 + 3 + TACTICON_HAPTICS_PLAYER_STOP_TACTICON_1 + + ../src/tacticonhapticsplayer.cpp + 261 + CTacticonHapticsPlayer + StopTacticon + + + + e_TACTICON_HAPTICS_PLAYER_STOP_TACTICON 0 + 4 + TACTICON_HAPTICS_PLAYER_STOP_TACTICON_0 + + ../src/tacticonhapticsplayer.cpp + 266 + CTacticonHapticsPlayer + StopTacticon + + + + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tacticonserver/server/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,6 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTICON_PERFORMANCE=0x40 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_SERVER_PLAY_TACTICON_0=0x2 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_SERVER_PLAY_TACTICON_1=0x1 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_SERVER_STOP_TACTICON_0=0x4 +[TRACE]TACTICON_PERFORMANCE[0x40]_TACTICON_SERVER_STOP_TACTICON_1=0x3 diff -r 000000000000 -r d54f32e146dd tacticonserver/server/traces/tacticonserverTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/traces/tacticonserverTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,18 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTICONSERVERTRACES_H__ +#define __TACTICONSERVERTRACES_H__ + +#define KOstTraceComponentID 0x2001fe4d + +#define TACTICON_SERVER_PLAY_TACTICON_1 0x400001 +#define TACTICON_SERVER_PLAY_TACTICON_0 0x400002 +#define TACTICON_SERVER_STOP_TACTICON_1 0x400003 +#define TACTICON_SERVER_STOP_TACTICON_0 0x400004 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tacticonserver/server/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/server/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,52 @@ + + 537001549 + tacticonserver + + 64 + TACTICON_PERFORMANCE + + e_TACTICON_SERVER_PLAY_TACTICON 1 + 1 + TACTICON_SERVER_PLAY_TACTICON_1 + + ../src/tacticonserver.cpp + 213 + CTacticonServer + PlayTacticon + + + + e_TACTICON_SERVER_PLAY_TACTICON 0 + 2 + TACTICON_SERVER_PLAY_TACTICON_0 + + ../src/tacticonserver.cpp + 218 + CTacticonServer + PlayTacticon + + + + e_TACTICON_SERVER_STOP_TACTICON 1 + 3 + TACTICON_SERVER_STOP_TACTICON_1 + + ../src/tacticonserver.cpp + 235 + CTacticonServer + StopTacticon + + + + e_TACTICON_SERVER_STOP_TACTICON 0 + 4 + TACTICON_SERVER_STOP_TACTICON_0 + + ../src/tacticonserver.cpp + 240 + CTacticonServer + StopTacticon + + + + diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/data/tacticon.rul --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/data/tacticon.rul Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,59 @@ + \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/data/tacticonactionplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/data/tacticonactionplugin.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registery info for Tacticon action plugin. +* Part of: Tacticon Server. +* +*/ + + +#include +#include + +#include "tacticonactionpluginconst.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = KTacticonActionPluginDllUid; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KActionPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KTacticonActionPluginImplementationUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build file for the TacticonActionPlugIn +* Part of: Tacticon Server. +* +*/ + +#include + +#ifdef RD_CONTEXT_FRAMEWORK +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/tacticonactionplugin.iby CORE_IBY_EXPORT_PATH(mw, tacticonactionplugin.iby) + +../data/tacticon.rul\ + /epoc32/RELEASE/winscw/UDEB/Z/private/10282BC4/Rules/tacticon.rul + +../data/tacticon.rul\ + /epoc32/data/Z/private/10282BC4/Rules/tacticon.rul + +#ifndef TOOLS + +PRJ_MMPFILES +tacticonactionplugin.mmp + +#endif // TOOLS + +#endif // RD_CONTEXT_FRAMEWORK diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/group/tacticonactionplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/group/tacticonactionplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for the TacticonActionPlugIn +* Part of: Tacticon Server. +* +*/ + + +#include +#include "../inc/tacticonactionpluginconst.hrh" + +TARGET tacticonactionplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D KTacticonActionPluginDllUid +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE main.cpp +SOURCE tacticonactionplugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE tacticonactionplugin.rss +TARGET tacticonactionplugin.rsc +TARGETPATH /resource/plugins +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY cfactivatorengine.lib +LIBRARY cfservices.lib +LIBRARY centralrepository.lib +LIBRARY tacticon.lib + +#ifdef LOGGING_MODE_FILE +LIBRARY flogger.lib +#endif diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/inc/tacticonactionplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/inc/tacticonactionplugin.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for disabling/enabling tacticons. +* Part of: Tacticon Server. +* +*/ + + +#ifndef C_TACTICONACTIONPLUGIN_H +#define C_TACTICONACTIONPLUGIN_H + +// INCLUDES +#include +#include +#include + +/** +* Class CTacticonActionPlugIn. +* +* Disable/enable/play tacticons when needed. +* Triggered when the conditions from the rule file are valid. +*/ +class CTacticonActionPlugIn : public CCFActionPlugIn + { +public: + + /** + * Two phased constructor. + * @since S60 5.2 + */ + static CTacticonActionPlugIn* NewL(); + + /** + * Two phased constructor. + * @since S60 5.2 + */ + static CTacticonActionPlugIn* NewLC(); + + /** + * Destructor. + * @since S60 5.2 + */ + virtual ~CTacticonActionPlugIn(); + +public: // From CCFActionPlugIn + /** + * @see CCFActionPlugIn + */ + void InitializeL(); + + /** + * @see CCFActionPlugIn + */ + TExecutionTime ExecuteL( + CCFActionIndication* aActionIndication ); + + /** + * @see CCFActionPlugIn + */ + void GetActionsL( CDesCArray& aActionList ) const; + + /** + * @see CCFActionPlugIn + */ + const TSecurityPolicy& SecurityPolicy() const; + +protected: + + /** + * C++ constructor + */ + CTacticonActionPlugIn(); + +private: // data + /** + * Tacticon server interface. + * Own. + */ + RTacticon iTacticon; + + /** + * Boolean value, which determines if tacticons are enabled + * during voice call. + */ + TBool iEnabledDuringCall; + + /** + * Tacticon settings bitmap, which determines Tacticon playback + * when voice call is connected/disconnected. + */ + TInt iTacticonCallSettings; + + /** + * Flag for proximity detection. + */ + TBool iProximityDiscernible; + + /** + * Flag for playing 'call connected' tacticon only when call + * was initiated by this device. + */ + TBool iCallInitiated; + + }; + +#endif // C_TACTICONACTIONPLUGIN_H diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/inc/tacticonactionpluginconst.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/inc/tacticonactionpluginconst.hrh Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains plugin's UID from mmp- and rss-files. +* Part of: Tacticon Server. +* +*/ + + + +#ifndef TACTICONACTIONPLUGINCONST_HRH +#define TACTICONACTIONPLUGINCONST_HRH + +// UIDs for Tacticon Action Plugin DLL and ECom implementation +#define KTacticonActionPluginDllUid 0x20022D86 +#define KTacticonActionPluginImplementationUid 0x20022D87 + +#endif // TACTICONACTIONPLUGINCONST_HRH diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/rom/tacticonactionplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/rom/tacticonactionplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the IBY file for Tacticon Action Plugin +* component. +* Part of: Tacticon Server. +* +*/ + +#ifndef TACTICONACTIONPLUGIN_IBY +#define TACTICONACTIONPLUGIN_IBY + +#include + +// ============================================================================= +// Tacticon Action Plugin +// ============================================================================= +ECOM_PLUGIN( tacticonactionplugin.dll, tacticonactionplugin.rsc ) +data=\epoc32\data\Z\private\10282BC4\Rules\tacticon.rul private\10282BC4\Rules\tacticon.rul + +#endif // TACTICONACTIONPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/src/main.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for disabling/enabling tacticons. +* Part of: Tacticon Server. +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "tacticonactionplugin.h" +#include "tacticonactionpluginconst.hrh" + +// ----------------------------------------------------------------------------- +// Provides a key value pair table, which is used to identify the correct +// construction function for the requested interface. +// ----------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KTacticonActionPluginImplementationUid, + CTacticonActionPlugIn::NewL ) + }; + +// ----------------------------------------------------------------------------- +// Returns an instance of the proxy table. +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount + = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r d54f32e146dd tacticonserver/tacticonactionplugin/src/tacticonactionplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tacticonserver/tacticonactionplugin/src/tacticonactionplugin.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for disabling/enabling tacticons. +* Part of: Tacticon Server. +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "tacticonactionplugin.h" +#include "tacticonprivatecrkeys.h" +#include "tacticontrace.h" + +// CONSTANTS + +// Constants for tactile feedback actions + +_LIT( KTacticonAction, "Tacticon" ); +_LIT( KTacticonMode, "Mode" ); + +_LIT( KTacticonCallDialling, "CALL_DIALLING" ); +_LIT( KTacticonCallConnected, "CALL_CONNECTED" ); +_LIT( KTacticonCallDisconnected, "CALL_DISCONNECTED" ); +_LIT( KProximityOn, "PROXIMITY_ON" ); +_LIT( KProximityOff, "PROXIMITY_OFF" ); + +// Security policy +_LIT_SECURITY_POLICY_PASS( KSecurityPolicy ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTacticonActionPlugIn::CTacticonActionPlugIn +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CTacticonActionPlugIn::CTacticonActionPlugIn( ) + : CCFActionPlugIn(), + iProximityDiscernible(ETrue), iCallInitiated( EFalse ) + { + } + +// ----------------------------------------------------------------------------- +// CTacticonActionPlugIn::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTacticonActionPlugIn* CTacticonActionPlugIn::NewL( ) + { + CTacticonActionPlugIn* self = CTacticonActionPlugIn::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CTacticonActionPlugIn::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTacticonActionPlugIn* CTacticonActionPlugIn::NewLC( ) + { + CTacticonActionPlugIn* self = new( ELeave ) CTacticonActionPlugIn(); + CleanupStack::PushL( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CTacticonActionPlugIn::~CTacticonActionPlugIn +// Destructor. +// ----------------------------------------------------------------------------- +// +CTacticonActionPlugIn::~CTacticonActionPlugIn() + { + iTacticon.Close(); + } + +//----------------------------------------------------------------------------- +// CTacticonActionPlugIn::InitializeL +// Initializes the plugin, called by the CF framework. +//----------------------------------------------------------------------------- +// +void CTacticonActionPlugIn::InitializeL() + { + TRACE("CTacticonActionPlugIn::InitializeL(): start"); + User::LeaveIfError( iTacticon.Connect() ); + + CRepository* repository = CRepository::NewL( KCRUidTacticon ); + CleanupStack::PushL( repository ); + + User::LeaveIfError( repository->Get( KTacticonDuringCall, + iEnabledDuringCall ) ); + + User::LeaveIfError( repository->Get( KTacticonSet, + iTacticonCallSettings ) ); + CleanupStack::PopAndDestroy( repository ); + TRACE("CTacticonActionPlugIn::InitializeL(): end"); + } + +//----------------------------------------------------------------------------- +// CTacticonActionPlugIn::ExecuteL +// Executes an action. +//----------------------------------------------------------------------------- +// +CCFActionPlugIn::TExecutionTime CTacticonActionPlugIn::ExecuteL( + CCFActionIndication* aActionIndication ) + { + TRACE("CTacticonActionPlugIn::ExecuteL(): start"); + + // get action parameters + const RKeyValueArray& parameters = aActionIndication->Parameters(); + + for( TInt i = 0; i < parameters.Count(); i++ ) + { + // get received parameter and its value + TPtrC param( parameters[i]->Key() ); + TPtrC value( parameters[i]->Value() ); + // check command + if ( param == KTacticonMode ) + { + if ( value == KProximityOn ) + { + TRACE("CTacticonActionPlugIn::ExecuteL(): Proximity ON"); + iProximityDiscernible = ETrue; + } + else if ( value == KProximityOff ) + { + TRACE("CTacticonActionPlugIn::ExecuteL(): Proximity OFF"); + iProximityDiscernible = EFalse; + } + else if ( value == KTacticonCallDialling ) + { + iCallInitiated = ETrue; + } + else if ( value == KTacticonCallConnected ) + { + TRACE("CTacticonActionPlugIn::ExecuteL(): Call Connected"); + if ( iCallInitiated && + !iProximityDiscernible && + ( iTacticonCallSettings & KTacticonSetCallConnected ) ) + { + iTacticon.PlayTacticon( ENeutralTacticon ); + } + if ( !iEnabledDuringCall ) + { + iTacticon.EnableTacticons( EFalse ); + } + } + else if ( value == KTacticonCallDisconnected ) + { + TRACE("CTacticonActionPlugIn::ExecuteL(): Call Disconnected"); + iTacticon.EnableTacticons( ETrue ); + iCallInitiated = EFalse; + } + } + } + TRACE("CTacticonActionPlugIn::ExecuteL(): end"); + + // not async operation --> return always ENone + return CCFActionPlugIn::ENone; + } + +//----------------------------------------------------------------------------- +// CTacticonActionPlugIn::GetActionsL +// Returns all the actions the plugin can perform. +//----------------------------------------------------------------------------- +// +void CTacticonActionPlugIn::GetActionsL( CDesCArray& aActionList ) const + { + TRACE("CTacticonActionPlugIn::GetActionsL(): start"); + + aActionList.AppendL( KTacticonAction ); + + TRACE("CTacticonActionPlugIn::GetActionsL(): end"); + } + +//----------------------------------------------------------------------------- +// CTacticonActionPlugIn::SecurityPolicy +// Returns the capabilities required by the plugin. +//----------------------------------------------------------------------------- +// +const TSecurityPolicy& CTacticonActionPlugIn::SecurityPolicy() const + { + TRACE("CTacticonActionPlugIn::SecurityPolicy()"); + + return KSecurityPolicy; + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Master bld.inf -file for whole Tactile Feedback subsystem. +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_EXPORTS +../rom/tactilefeedback.iby CORE_IBY_EXPORT_PATH(mw, tactilefeedback.iby) + +#ifndef TOOLS + +#include "../TactileAreaRegistry/group/bld.inf" +#include "../TactileFeedbackResolver/group/bld.inf" +#include "../TactileClickPlugin/group/bld.inf" +#include "../TactileFeedbackClient/group/bld.inf" +#include "../TactileActionPlugin/group/bld.inf" + +#endif // TOOLS diff -r 000000000000 -r d54f32e146dd tactilefeedback/inc/tactilefeedbacktrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/inc/tactilefeedbacktrace.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Master trace -file for whole Tactile Feedback subsystem. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef TACTILEFEEDBACKTRACE_H +#define TACTILEFEEDBACKTRACE_H + +#include + + +#ifndef _DEBUG + + #define TRACE( x ) + #define TRACE2( x, y ) + #define TRACE3( x, y, z ) + #define TRACE4( x, y, z, zz ) + #define TRACE5( x, y, z, zz, zzz ) + +#else + +#include +#include // RDebug + +#define TRACE( x ) RDebug::Print( _L( x ) ) +#define TRACE2( x, y ) RDebug::Print( _L( x ), ( y ) ) +#define TRACE3( x, y, z ) RDebug::Print( _L( x ), ( y ), ( z ) ) +#define TRACE4( x, y, z, zz ) RDebug::Print( _L( x ), ( y ), ( z ), ( zz ) ) +#define TRACE5( x, y, z, zz, zzz ) RDebug::Print( _L( x ), ( y ), ( z ), ( zz ), ( zzz ) ) + +#endif // _DEBUG + +#endif // TACTILEFEEDBACKTRACE_H + diff -r 000000000000 -r d54f32e146dd tactilefeedback/rom/tactilefeedback.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/rom/tactilefeedback.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the master IBY file for Tactile Feedback subsystem. +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILEFEEDBACK_IBY +#define TACTILEFEEDBACK_IBY + +#include + +// ============================================================================= +// Tactile Feedback subsystem components +// ============================================================================= + + +// Tactile Area Registry +file=ABI_DIR\BUILD_DIR\tactilearearegistry.dll SHARED_LIB_DIR\tactilearearegistry.dll + +// Tactile Feedback Client +file=ABI_DIR\BUILD_DIR\touchfeedback.dll SHARED_LIB_DIR\touchfeedback.dll + + +#endif // TACTILEFEEDBACK_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/data/tactile.rul --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/data/tactile.rul Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,35 @@ + \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/data/tactileactionplugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/data/tactileactionplugin.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Registery info for Tactile action plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include +#include + +#include "tactileactionpluginconst.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = KTactileActionPluginDllUid; + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KActionPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KTactileActionPluginImplementationUid; + version_no = 1; + display_name = ""; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 file for the TactileActionPlugIn +* Part of: Tactile Feedback. +* +*/ + +#include + +#ifdef RD_CONTEXT_FRAMEWORK +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/tactileactionplugin.iby CORE_IBY_EXPORT_PATH(mw, tactileactionplugin.iby) + +../data/tactile.rul\ + /epoc32/RELEASE/winscw/UDEB/Z/private/10282BC4/Rules/tactile.rul + +../data/tactile.rul\ + /epoc32/data/Z/private/10282BC4/Rules/tactile.rul + +#ifndef TOOLS + +PRJ_MMPFILES +tactileactionplugin.mmp + +#endif // TOOLS + +#endif // RD_CONTEXT_FRAMEWORK diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/group/tactileactionplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/group/tactileactionplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for the TactileActionPlugIn +* Part of: Tactile Feedback. +* +*/ + + +#include +#include "../inc/tactileactionpluginconst.hrh" + +TARGET tactileactionplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D KTactileActionPluginDllUid +CAPABILITY ALL -TCB + +SOURCEPATH ../src +SOURCE main.cpp +SOURCE tactileactionplugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE tactileactionplugin.rss +TARGET tactileactionplugin.rsc +TARGETPATH /resource/plugins +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY bafl.lib +LIBRARY cfactivatorengine.lib +LIBRARY cfservices.lib +LIBRARY centralrepository.lib + +#ifdef LOGGING_MODE_FILE +LIBRARY flogger.lib +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/inc/tactileactionplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/inc/tactileactionplugin.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for turning tactile feedback on/off. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEACTIONPLUGIN_H +#define C_TACTILEACTIONPLUGIN_H + +// INCLUDES +#include +#include + +/** +* Class CTactileActionPlugIn. +* +* Turns tactile feedback on/off when needed. +* Triggered when the conditions from the rule file are valid. +*/ +class CTactileActionPlugIn : public CCFActionPlugIn + { +public: + + /** + * Two phased constructor. + */ + static CTactileActionPlugIn* NewL(); + + /** + * Two phased constructor. + */ + static CTactileActionPlugIn* NewLC(); + + /** + * Destructor. + */ + ~CTactileActionPlugIn(); + +public: // From CCFActionPlugIn + + /** + * @see CCFActionPlugIn + */ + void InitializeL(); + + /** + * @see CCFActionPlugIn + */ + TExecutionTime ExecuteL( + CCFActionIndication* aActionIndication ); + + /** + * @see CCFActionPlugIn + */ + void GetActionsL( CDesCArray& aActionList ) const; + + /** + * @see CCFActionPlugIn + */ + const TSecurityPolicy& SecurityPolicy() const; + +protected: + + /** + * C++ constructor + */ + CTactileActionPlugIn(); + +private: + TInt iFeedbackInCall; + + }; + +#endif // C_TACTILEACTIONPLUGIN_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/inc/tactileactionpluginconst.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/inc/tactileactionpluginconst.hrh Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Contains plugin's UID from mmp- and rss-files. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef TACTILEACTIONPLUGINCONST_HRH +#define TACTILEACTIONPLUGINCONST_HRH + +// UIDs for Tactile Action Plugin DLL and ECom implementation +#define KTactileActionPluginDllUid 0x2000B495 +#define KTactileActionPluginImplementationUid 0x2000B496 + +#endif // TACTILEACTIONPLUGINCONST_HRH diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/rom/tactileactionplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/rom/tactileactionplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the IBY file for Tactile Action Plugin +* component. +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILEACTIONPLUGIN_IBY +#define TACTILEACTIONPLUGIN_IBY + +#include + +// ============================================================================= +// Tactile Action Plugin +// ============================================================================= +ECOM_PLUGIN( tactileactionplugin.dll, tactileactionplugin.rsc ) +data=\epoc32\data\Z\private\10282BC4\Rules\tactile.rul private\10282BC4\Rules\tactile.rul + +#endif // TACTILEACTIONPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/src/main.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for turning tactile feedback on/off. +* Part of: Tactile Feedback. +* +*/ + + +// INCLUDE FILES +#include +#include + +#include "tactileactionplugin.h" +#include "tactileactionpluginconst.hrh" + +// ----------------------------------------------------------------------------- +// Provides a key value pair table, which is used to identify the correct +// construction function for the requested interface. +// ----------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( + KTactileActionPluginImplementationUid, + CTactileActionPlugIn::NewL ) + }; + +// ----------------------------------------------------------------------------- +// Returns an instance of the proxy table. +// ----------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( + TInt& aTableCount ) + { + aTableCount + = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileactionplugin/src/tactileactionplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileactionplugin/src/tactileactionplugin.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A plug-in for turning tactile feedback on/off. +* Part of: Tactile Feedback. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "tactileactionplugin.h" +#include "tactilefeedbackinternalpskeys.h" +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbacktrace.h" + +// CONSTANTS + +// Constants for tactile feedback actions +_LIT( KActionId, "Tactile" ); +_LIT( KActionIdCommand, "Feedback" ); +_LIT( KActionCommandOn, "ON" ); +_LIT( KActionCommandOff, "OFF" ); + +// Constants used for setting Tactile Feedback while in-call and while +// no call is in progress. See tactilefeedbackinternalpskeys.h for +// documentation. +const TInt KTactilePSValueWhileInCall = 0x00; // Vibra and audio disabled +const TInt KTactilePSValueWhileInCallAudioOff = 0x01; // Vibra enabled, audio disabled +const TInt KTactilePSValueWhileInCallVibraOff = 0x02; // Vibra disabled, audio enabled +const TInt KTactilePSValueWhileNoCall = 0x03; // Vibra and audio enabled + +// Security policy +_LIT_SECURITY_POLICY_PASS( KSecurityPolicy ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CTactileActionPlugIn::CTactileActionPlugIn +// C++ default constructor. +// ----------------------------------------------------------------------------- +// +CTactileActionPlugIn::CTactileActionPlugIn( ) + : CCFActionPlugIn() + { + } + +// ----------------------------------------------------------------------------- +// CTactileActionPlugIn::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTactileActionPlugIn* CTactileActionPlugIn::NewL( ) + { + CTactileActionPlugIn* self = CTactileActionPlugIn::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CTactileActionPlugIn::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CTactileActionPlugIn* CTactileActionPlugIn::NewLC( ) + { + CTactileActionPlugIn* self = new( ELeave ) CTactileActionPlugIn(); + CleanupStack::PushL( self ); + return self; + } + + +// ----------------------------------------------------------------------------- +// CTactileActionPlugIn::~CTactileActionPlugIn +// Destructor. +// ----------------------------------------------------------------------------- +// +CTactileActionPlugIn::~CTactileActionPlugIn() + { + } + +//----------------------------------------------------------------------------- +// CTactileActionPlugIn::InitializeL +// Initializes the plugin, called by the CF framework. +//----------------------------------------------------------------------------- +// +void CTactileActionPlugIn::InitializeL() + { + TRACE("CTactileActionPlugIn::InitializeL(): start"); + CRepository* repository = CRepository::NewL( KCRUidTactileFeedback ); + CleanupStack::PushL( repository ); + + TInt tactileSettings(0); + repository->Get( KTactileInternalSettings, tactileSettings ); + + // Clean all other settings values, leave only in-call settings. + tactileSettings &= ( KTactileInternalSettingsCallDisableVibra | + KTactileInternalSettingsCallDisableAudio ); + + switch ( tactileSettings ) + { + case KTactileInternalSettingsCallDisableVibra: + iFeedbackInCall = KTactilePSValueWhileInCallVibraOff; + break; + case KTactileInternalSettingsCallDisableAudio: + iFeedbackInCall = KTactilePSValueWhileInCallAudioOff; + break; + case ( KTactileInternalSettingsCallDisableVibra | + KTactileInternalSettingsCallDisableAudio ): + iFeedbackInCall = KTactilePSValueWhileInCall; + break; + default: + iFeedbackInCall = KTactilePSValueWhileNoCall; + break; + } + CleanupStack::PopAndDestroy( repository ); + TRACE("CTactileActionPlugIn::InitializeL(): end"); + } + +//----------------------------------------------------------------------------- +// CTactileActionPlugIn::ExecuteL +// Executes an action. +//----------------------------------------------------------------------------- +// +CCFActionPlugIn::TExecutionTime CTactileActionPlugIn::ExecuteL( + CCFActionIndication* aActionIndication ) + { + TRACE("CTactileActionPlugIn::ExecuteL(): start"); + + // get action parameters + const RKeyValueArray& parameters = aActionIndication->Parameters(); + + for( TInt i = 0; i < parameters.Count(); i++ ) + { + // get received parameter and its value + TPtrC param( parameters[i]->Key() ); + TPtrC value( parameters[i]->Value() ); + + // check command + if ( param == KActionIdCommand ) + { + TInt err = KErrNone; + + if ( value == KActionCommandOn ) + { + // Turn tactile feedback on + TRACE( "CTactileActionPlugIn::ExecuteL(): Feedback set ON"); + err = RProperty::Set( KPSUidTactileFeedback, + KTactileFeedbackEnabled, + KTactilePSValueWhileNoCall ); + } + else if ( value == KActionCommandOff ) + { + // Turn tactile feedback off + TRACE("CTactileActionPlugIn::ExecuteL(): Feedback set OFF"); + err = RProperty::Set( KPSUidTactileFeedback, + KTactileFeedbackEnabled, + iFeedbackInCall ); + } + + TRACE2("CTactileActionPlugIn::ExecuteL(): Set returned %d", err); + + User::LeaveIfError( err ); + } + } + + TRACE("CTactileActionPlugIn::ExecuteL(): end"); + + // not async operation --> return always ENone + return CCFActionPlugIn::ENone; + } + +//----------------------------------------------------------------------------- +// CTactileActionPlugIn::GetActionsL +// Returns all the actions the plugin can perform. +//----------------------------------------------------------------------------- +// +void CTactileActionPlugIn::GetActionsL( CDesCArray& aActionList ) const + { + TRACE("CTactileActionPlugIn::GetActionsL(): start"); + + aActionList.AppendL( KActionId ); + + TRACE("CTactileActionPlugIn::GetActionsL(): end"); + } + +//----------------------------------------------------------------------------- +// CTactileActionPlugIn::SecurityPolicy +// Returns the capabilities required by the plugin. +//----------------------------------------------------------------------------- +// +const TSecurityPolicy& CTactileActionPlugIn::SecurityPolicy() const + { + TRACE("CTactileActionPlugIn::SecurityPolicy()"); + + return KSecurityPolicy; + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/bwins/tactilearearegistryu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/bwins/tactilearearegistryu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,8 @@ +EXPORTS + ?HandleConnectL@CTactileAreaRegistry@@QAEXABUTTactileFeedbackConnectData@@@Z @ 1 NONAME ; void CTactileAreaRegistry::HandleConnectL(struct TTactileFeedbackConnectData const &) + ?HandleDisconnect@CTactileAreaRegistry@@QAEXABUTTactileFeedbackDisconnectData@@@Z @ 2 NONAME ; void CTactileAreaRegistry::HandleDisconnect(struct TTactileFeedbackDisconnectData const &) + ?HandleWindowGroupClosed@CTactileAreaRegistry@@QAEXH@Z @ 3 NONAME ; void CTactileAreaRegistry::HandleWindowGroupClosed(int) + ?HandleWindowGroupCreated@CTactileAreaRegistry@@QAEXHI@Z @ 4 NONAME ; void CTactileAreaRegistry::HandleWindowGroupCreated(int, unsigned int) + ?HitTestPointerEvent@CTactileAreaRegistry@@QAE?AW4TTouchLogicalFeedback@@ABUTPointerEvent@@HK@Z @ 5 NONAME ; enum TTouchLogicalFeedback CTactileAreaRegistry::HitTestPointerEvent(struct TPointerEvent const &, int, unsigned long) + ?NewL@CTactileAreaRegistry@@SAPAV1@XZ @ 6 NONAME ; class CTactileAreaRegistry * CTactileAreaRegistry::NewL(void) + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/eabi/tactilearearegistryu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/eabi/tactilearearegistryu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,10 @@ +EXPORTS + _ZN20CTactileAreaRegistry14HandleConnectLERK27TTactileFeedbackConnectData @ 1 NONAME + _ZN20CTactileAreaRegistry16HandleDisconnectERK30TTactileFeedbackDisconnectData @ 2 NONAME + _ZN20CTactileAreaRegistry19HitTestPointerEventERK13TPointerEventim @ 3 NONAME + _ZN20CTactileAreaRegistry23HandleWindowGroupClosedEi @ 4 NONAME + _ZN20CTactileAreaRegistry24HandleWindowGroupCreatedEij @ 5 NONAME + _ZN20CTactileAreaRegistry4NewLEv @ 6 NONAME + _ZTI20CTactileAreaRegistry @ 7 NONAME ; ## + _ZTV20CTactileAreaRegistry @ 8 NONAME ; ## + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Area registry management and hit testing for pointer events. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../inc/tactilearearegistry.h |../../inc/tactilearearegistry.h +../inc/tactileinternaldatatypes.h |../../inc/tactileinternaldatatypes.h + +PRJ_MMPFILES +../group/tactilearearegistry.mmp + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/group/tactilearearegistry.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/group/tactilearearegistry.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Area registry management and hit testing for pointer events. +* Part of: Tactile Feedback. +* +*/ + + + +#include +#include + +TARGET tactilearearegistry.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000B492 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactilearearegistry.cpp + +USERINCLUDE ../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../inc + +LIBRARY euser.lib + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/inc/tactilearearegistry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/inc/tactilearearegistry.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,308 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The class to be used from server side for accessing registry. +* Hit testing is done using this API. +* Part of: Tactile Feedback. +* +*/ + + + + +#ifndef C_TACTILEAREAREGISTRY_H +#define C_TACTILEAREAREGISTRY_H + + +#include +#include + +#include +#include "tactileinternaldatatypes.h" + + +/** + * Access to area registry from server side. + * + * This class defines the interface that is used from server side for + * managing area registry (e.g. handling connect and disconnect requests) + * + * The main purpose of this class is to do hit testing of pointer events, + * for knowing if feedback should be triggered based on the pointer event. + * + * This class also implements bookkeeping of created window groups and + * corresponding window server connection handles. This information is + * used for finding correct application's registry entries when a pointer + * event arrives (application usually has only one window group, but some + * pop-up controls create additional ones). + * + * @lib tactilearearegistry.lib + * @since S60 v5.0 + */ +class CTactileAreaRegistry: public CBase + { +public: + + IMPORT_C static CTactileAreaRegistry* NewL(); + + virtual ~CTactileAreaRegistry(); + + /** + * Handles connection requests from client application. This has to be + * called for every application that connects to the click plugin. + * + * Area registry immediately tries to connect to the chunk created + * by client application. This function leaves with Standard + * Symbian OS error codes in case connection fails. + * + * @param aData - The data sent by client application. + */ + IMPORT_C void HandleConnectL( const TTactileFeedbackConnectData& aData ); + + + /** + * Handles disconnect request from client application. This has to be + * called for every application that disconnects from the click plugin. + * + * @param aData - The data sent by client application. + */ + IMPORT_C void HandleDisconnect( + const TTactileFeedbackDisconnectData& aData ); + + + /** + * Records information about a newly created window group. + * + * This function has to be called when click plugin receives a + * notification about created window group. + * + * @param aIdentifier - Identifier of the created window group. + * @param aConnectionHandle - Connection handle of the window server + * client, who created the window group. + */ + IMPORT_C void HandleWindowGroupCreated( + TInt aIdentifier, TUint aConnectionHandle ); + + + /** + * Clears stored information about a window group that is closed. + * + * This function has to be called when click plugin receives a + * notification about closed window group. + * + * @param aIdentifier - Window group identifier of the window group + * that was closed. + */ + IMPORT_C void HandleWindowGroupClosed( TInt aIdentifier ); + + /** + * Does hit testing of given pointer event against area registry content. + * + * Hit testing is done in three phases: + * + * 1. First this function uses window group identifier for finding the + * application, which shall receive the pointer event (registry + * contents has to be grouped by applicaitons because window + * identifiers are only unique inside one application) + * + * 2. Window handle is used for finding those registry entries, which + * are registered to the same window where pointer event hit now + * (coordinates are window -relative). + * + * 3. Window's registry entries are hit tested one by one against the + * given pointer event, and in case a match is found, then + * corresponding registry entries feedback type is returned. + * + * @param aPointerEvent - The pointer event. + * @param aWgIdentifier - Identifier of the window group, where pointer + * event hit. + * @param aWindowHandle - Handle number of the window, where pointer + * event hit. + * @return The logical feedback type that was triggered by the pointer + * event, or ETouchFeedbackNone in case pointer event did not + * hit any feedback area. + */ + IMPORT_C TTouchLogicalFeedback HitTestPointerEvent( + const TPointerEvent& aPointerEvent, + TInt aWgIdentifier, + TUint32 aWindowHandle ); + + +private: + + CTactileAreaRegistry(); + + /** + * This function is used for hit testing one chunk. + * + * It is assumed that the given chunk is the chunk of that application, + * where pointer event shall be delivered. + * + * @param aPointerEvent - The pointer event. + * @param aWgIdentifier - Identifier of the window group, where pointer + * event hit. + * @param aWindowHandle - Handle number of the window, where pointer + * event hit. + * @return The logical feedback type that was triggered by the pointer + * event, or ETouchFeedbackNone in case pointer event did not + * hit any feedback area. + */ + TTouchLogicalFeedback HitTestChunk( + RChunk& aChunk, + const TPointerEvent& aPointerEvent, + TInt aWgIdentifier, + TUint32 aWindowHandle ); + + /** + * This function checks whether given pointer event and area registry + * entry match, and sets feedback type accordingly in case they match. + * + * It is assumed that pointer event shall hit that window, where given + * area is registered (as coordinates are window-relative). + * + * Notice that feedback is actually returned in reference parameter + * aFeedback, and the main return value of the function tells whether + * hit testing should be continued on next possible area or not. + * This is because feedback can be "None" even if pointer event + * hit the feedback area (because "None" is a valid type for feedback + * areas) + * + * @param aPointerEvent - The pointer event. + * @param aEntry - Area registry entry, representing feedback area + * in same window where pointer event hit. + * @param aWgIdentifier - Identifier of the window group, where pointer + * event hit. + * @param aWindowHandle - Handle number of the window, where pointer + * event hit. + * @return ETrue if the given pointer event matched given area registry + * entry, and hit testing should not be continued anymore. + * EFalse indicates that hit testing should be continued with + * next possibly matching feedback area. + */ + TBool HitTestRegistryEntry( + const TPointerEvent& aPointerEvent, + const TFeedbackChunkAreaEntry& aEntry, + TInt aWgIdentifier, + TUint32 aWindowHandle, + TTouchLogicalFeedback& aFeedback ); + + /** + * Finds the correct shared memory chunk based on window group id. + * + * This is used for performing first phase of hit testing. + * + * @param aWgIdentifier - Identifier of the window group, which chunk + * is searched. + * @return Valid index to member variable iChunkArray, or KErrNotFound + * in case given window group was not found. + */ + TInt ChunkIndexByWindowGroupId( TInt aWgIdentifier ) const; + + /** + * Finds window server client's connection handle based on given + * window group identifier. + * + * This is used for finding correct shared memory chunk based on window + * group identifier. + * + * @param aWgIdentifier - The window group identifier. + * @return Connection handle of the client, who has created the given + * window group. Zero is returned if no client is found. + */ + TUint ConnectionHandleByWgId( TInt aWgIdentifier ) const; + + +private: // data types + + /** + * Items of this type are stored into member variable iChunkArray. + * There is one item in the array for each connecting application. + * + * Stored window group id is the identifier of the main window group + * of connecting application. Stored connection handle is the + * window server connection handle of the application. + */ + struct TTactileAreaChunk + { + TInt iWindowGroupId; + TUint iConnectionHandle; + RChunk iChunk; + }; + + /** + * This type of items are used in member variable iWgArray, which + * is used for mapping window groups and client applications together. + */ + struct TTactileWgroupItem + { + TInt iWindowGroupId; + TUint iConnectionHandle; + }; + + + /** + * This auxiliary class is used for storing information about pen down + * event, so that we can know if pen up event happened in same feedback + * area as corresponding pen down event. This information is necessary + * in case we want to play feedback both on down- and up events, but only + * when those happen within same feedback area + * (to distinguish cancel -case) + */ + class TTactilePenDownEvent + { + public: + TTactilePenDownEvent(); + TTactilePenDownEvent( TInt aWindowGroupId, + TUint32 aWindowHandle, + TRect aFeedbackArea ); + void Reset(); + public: + TInt iWindowGroupId; + TUint32 iWindowHandle; + TRect iFeedbackArea; + }; + + +private: // data + + /** + * Array of chunk handles and identifying window group identifiers. + * Each entry in the array represents one application and its + * registered feedback areas. + */ + RArray iChunkArray; + + /** + * Here we store the information about created window groups. + * For each group we also store the connection handle, so that we can + * know into which application newly created window groups belong. + */ + RArray iWgArray; + + /** + * Handle to the global semaphore, which is used for mutual exclusion + * when accessing shared memory chunks. + */ + RSemaphore iTactileSemaphore; + + + /** + * Information about last received pen down event. This can be used + * for determining whether pen up event should produde feedback or not. + */ + TTactilePenDownEvent iLastPenDown; + + }; + + +#endif // C_TACTILEAREAREGISTRY_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/inc/tactileinternaldatatypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/inc/tactileinternaldatatypes.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Opcodes and data types used in communication between client +* process and window server. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef T_TACTILEINTERNALDATATYPES_H +#define T_TACTILEINTERNALDATATYPES_H + + + +#include +#include + + +/** + * These are used as opcodes (function number) in IPC communication + * between Tactile Feedback Client and the server hosting + * Tactile Area Registry (currently window server) + */ +enum TTactileFeedbackOpCodes + { + ETactileOpCodeConnect = 200, + ETactileOpCodeDisconnect = 201, + ETactileOpCodeImmediateFeedback = 202 + }; + +/** + * This is the data package that must be delivered with opcode + * ETouchOpCodeConnect. + */ +struct TTactileFeedbackConnectData + { + TInt iWindowGroupId; + TKName iChunkName; + }; + +/** + * This is the data package that must be delivered with opcode + * ETouchOpCodeDisconnect. + */ +struct TTactileFeedbackDisconnectData + { + TInt iWindowGroupId; + }; + +/** + * This is the data package that must be delivered with opcode + * ETactileOpCodeImmediateFeedback. + */ +struct TTactileFeedbackImmediateData + { + TTouchLogicalFeedback iFeedbackType; + TBool iPlayVibra; + TBool iPlayAudio; + }; + + +/** + * This struct represents one area registry entry in shared memory chunk. + * + * Top two bits of iFeedbackType field are used for coding vibra- + * and audio feedback status together with feedback type: + * + * 0x80000000 --> 1 If vibra feedback is enabled for this area + * 0x40000000 --> 1 If audio feedback is enabled for this area + * + */ +struct TFeedbackChunkAreaEntry + { + TRect iRect; + TTouchLogicalFeedback iFeedbackType; + TTouchEventType iEventType; + }; + +const TInt KTactileVibraBitDown = 0x80000000; +const TInt KTactileAudioBitDown = 0x40000000; +const TInt KTactileVibraBitUp = 0x20000000; +const TInt KTactileAudioBitUp = 0x10000000; + +_LIT( KTouchFeedbackSemaphore, "SemaphoreTouchFeedback"); + + +#endif // T_TACTILEINTERNALDATATYPES_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/src/tactilearearegistry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/src/tactilearearegistry.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,483 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The class to be used from server side for accessing registry. +* Hit testing is done using this API. +* Part of: Tactile Feedback. +* +*/ + + +#include +#include "tactilearearegistry.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactilearearegistryTraces.h" +#endif + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTactileAreaRegistry::TTactilePenDownEvent::TTactilePenDownEvent(): + iWindowGroupId( -1 ), iWindowHandle( 0 ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTactileAreaRegistry::TTactilePenDownEvent::TTactilePenDownEvent( + TInt aWindowGroupId, + TUint32 aWindowHandle, + TRect aFeedbackArea ): + iWindowGroupId( aWindowGroupId ), + iWindowHandle( aWindowHandle ), + iFeedbackArea( aFeedbackArea ) + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileAreaRegistry::TTactilePenDownEvent::Reset() + { + iWindowGroupId = -1 ; + iWindowHandle = 0; + } + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactileAreaRegistry::CTactileAreaRegistry() + { + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CTactileAreaRegistry* CTactileAreaRegistry::NewL() + { + CTactileAreaRegistry* self = new ( ELeave ) CTactileAreaRegistry; + + // We don't need ConstructL in this class for the moment, so we + // can just return the created instance right away. + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileAreaRegistry::~CTactileAreaRegistry() + { + iChunkArray.Close(); + iWgArray.Close(); + iTactileSemaphore.Close(); + } + + +// --------------------------------------------------------------------------- +// #1 Find the shared chunk created by client +// #2 Open handle to the found chunk +// #3 Store window group id and connection handle with the chunk, +// and add chunk to array +// #4 Open global semaphore in case it is not yet open +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactileAreaRegistry::HandleConnectL( + const TTactileFeedbackConnectData& aData ) + { + TRACE3("CTactileAreaRegistry::HandleConnectL - wgId = %d, Chunk = %S", + aData.iWindowGroupId, + &aData.iChunkName ); + + // #1 + TFindChunk findChunk( aData.iChunkName ); + + TFullName chunkFullName; + + TInt err = findChunk.Next( chunkFullName ); + + User::LeaveIfError( err ); + + // #2 + TTactileAreaChunk newChunk; + + err = newChunk.iChunk.OpenGlobal( chunkFullName, ETrue ); + + User::LeaveIfError( err ); + + CleanupClosePushL( newChunk.iChunk ); + + // #3 + newChunk.iWindowGroupId = aData.iWindowGroupId; + + newChunk.iConnectionHandle = + ConnectionHandleByWgId( aData.iWindowGroupId ); + + iChunkArray.AppendL( newChunk ); + + CleanupStack::Pop(); // newChunk.iChunk + + // #4 Open global semaphore in case it is not yet open + if ( !iTactileSemaphore.Handle() ) + { + err = iTactileSemaphore.OpenGlobal( KTouchFeedbackSemaphore ); + User::LeaveIfError( err ); + } + } + + +// --------------------------------------------------------------------------- +// We handle diconnect by finding client's chunk, closing it and then +// removing the entry from chunk array. +// +// #1 Find the correct entry +// #2 Close chunk +// #3 Remove entry from chunk array +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactileAreaRegistry::HandleDisconnect( + const TTactileFeedbackDisconnectData& aData ) + { + // #1 + for ( TInt i=0; i < iChunkArray.Count(); i++ ) + { + if ( iChunkArray[i].iWindowGroupId == aData.iWindowGroupId ) + { + // #2 + iChunkArray[i].iChunk.Close(); + + // #3 + iChunkArray.Remove( i ); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// Here we just store information (e.g. connection handle) about the +// newly created window group. +// +// Notice that we ignore possible error on purpose when adding new item to +// the array. Firstly a failure should be almost impossible, and secondly +// it would only cause feedback to be disabled for the newly created +// window group. +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactileAreaRegistry::HandleWindowGroupCreated( + TInt aIdentifier, TUint aConnectionHandle ) + { + TTactileWgroupItem newItem; + + newItem.iWindowGroupId = aIdentifier; + newItem.iConnectionHandle = aConnectionHandle; + + iWgArray.Append( newItem ); + } + + +// --------------------------------------------------------------------------- +// When window group is closed, we remove all information about it from +// the array (we don't destroy chunks because it has been done based +// on the disconnect request already). +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactileAreaRegistry::HandleWindowGroupClosed( + TInt aIdentifier ) + { + // Loop down so that deleting of items won't mix up the array + for ( TInt i = iWgArray.Count()-1; i >= 0; i-- ) + { + if ( iWgArray[i].iWindowGroupId == aIdentifier ) + { + iWgArray.Remove( i ); + } + } + } + + +// --------------------------------------------------------------------------- +// This is the implementation of hit testing. +// +// It is assumed that this function is not called unless there is at least +// one connected application, and unless iTactileSemaphore has been opened +// succesfully. +// +// #1 Check that we have valid handle to global semaphore. +// #2 Find correct chunk based on window group id. +// #3 Do actual hit testing in a separate function. +// #4 Return feedback type based on hit testing results. +// --------------------------------------------------------------------------- +// +EXPORT_C TTouchLogicalFeedback CTactileAreaRegistry::HitTestPointerEvent( + const TPointerEvent& aPointerEvent, + TInt aWgIdentifier, + TUint32 aWindowHandle ) + { + TTouchLogicalFeedback feedback(ETouchFeedbackNone); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_REGISTRY_HIT_TEST_1, "e_TACTILE_REGISTRY_HIT_TEST 1"); + + // #1 + if ( iTactileSemaphore.Handle() && + ( aPointerEvent.iType == TPointerEvent::EButton1Down || + aPointerEvent.iType == TPointerEvent::EButton1Up ) ) + { + // We keep performance trace here instead of beginning of function + // so that drag events won't confuse performance measurements. + + // #2 + TInt chunkIndex = ChunkIndexByWindowGroupId( aWgIdentifier ); + + // #3 If we found the window group where pointer event is going to land, + // then search for correct window (and area) in its shared chunk. + if ( chunkIndex >= 0 && chunkIndex < iChunkArray.Count() ) + { + feedback = HitTestChunk( + iChunkArray[chunkIndex].iChunk, + aPointerEvent, + aWgIdentifier, + aWindowHandle ); + } + } + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_REGISTRY_HIT_TEST_0, "e_TACTILE_REGISTRY_HIT_TEST 0"); + + // #4 + return feedback; + } + +// --------------------------------------------------------------------------- +// In this function we do hit testing for one chunk. +// +// There is currently support for feedback on both +// pen down and up -events. +// +// #1 Reset last pen down information in case this was a pen down -event. +// #2 Call wait on global semaphore for mutual exlusion of shared memory. +// #3 Start from the beginning of chunk, and read number of windows first. +// #4 Go through all windows in a loop +// --------------------------------------------------------------------------- +// +TTouchLogicalFeedback CTactileAreaRegistry::HitTestChunk( + RChunk& aChunk, + const TPointerEvent& aPointerEvent, + TInt aWgIdentifier, + TUint32 aWindowHandle ) + { + // #1 + if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) + { + iLastPenDown.Reset(); + } + + TTouchLogicalFeedback feedback = ETouchFeedbackNone; + + // #2 Protect shared memory chunks so that nobody can modify + // them in the middle of hit testing. + iTactileSemaphore.Wait(); + + // #3 + TInt* base = (TInt*) aChunk.Base(); + + TInt windowCount = *base; + base++; + + TBool windowFound(EFalse); + + // #4 Iterate though windows + for ( TInt i=0; i < windowCount && !windowFound; i++ ) + { + // Read handle identifier of this window + TInt wsHandle = *base; + base++; + // Read number of areas registered to this window + TInt areaCount = *base; + base++; + // Read offset to the area data of this window + TInt offset = *base; + base++; + + // Check if this window is the one where pointer event hit. + if ( wsHandle == static_cast( aWindowHandle ) ) + { + // Set pointer to the first area belonging to this window. + TFeedbackChunkAreaEntry* entryPtr = + reinterpret_cast( aChunk.Base() + offset ); + + TBool matchFound = EFalse; + + // Go through all areas and test each one against the pointer + // event as long as a match is found. + for ( TInt j = 0; j < areaCount && !matchFound; j++ ) + { + matchFound = HitTestRegistryEntry( aPointerEvent, + *entryPtr, + aWgIdentifier, + aWindowHandle, + feedback ); + + entryPtr++; + } + + // No need to continue in the loop, + // because window found already + windowFound = ETrue; + } + } + + // Release the semaphore so that applications can do updates to + // registry again. + iTactileSemaphore.Signal(); + + return feedback; + } + + +// --------------------------------------------------------------------------- +// Here we analyse the pointer event type against feedback area entry, that +// is located in same window where the pointer event hit. +// +// This functionality is encapsulated into separate function mainly +// because this is the only part of the implementation that needs +// to be modified in case we'll have different kinds of down- and up event +// combinations (there could be different types for e.g. in situations were +// up event is / is not required to match down event for it to trigger +// feedback). +// +// Here we also record details of pen down events (that trigger feedback), so +// that we can check on pen up event in case it matches the same feedback +// area where down -event landed. +// +// #1 First see if pointer event even hit the area +// +// #2 Currently pen down event always generates feedback +// +// #3 We trigger feedback on pen up event only if it matches the same +// feedback area, where corresponding down event hit. +// +// --------------------------------------------------------------------------- +// +TBool CTactileAreaRegistry::HitTestRegistryEntry( + const TPointerEvent& aPointerEvent, + const TFeedbackChunkAreaEntry& aEntry, + TInt aWgIdentifier, + TUint32 aWindowHandle, + TTouchLogicalFeedback& aFeedback ) + { + TBool matchFound = EFalse; + + // #1 + if ( aEntry.iRect.Contains( aPointerEvent.iPosition) ) + { + TInt enablers = aEntry.iFeedbackType & ( KTactileVibraBitDown | + KTactileAudioBitDown | + KTactileVibraBitUp | + KTactileAudioBitUp ); + TInt feedbackDown = aEntry.iFeedbackType & 0x3FF; // the first 10 bits + TInt feedbackUp = aEntry.iFeedbackType & (0x3FF << 10); // next 10 bits + feedbackUp = feedbackUp >> 10; + // #2 Pointer down on the area always triggers feedback + if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down )) + { + matchFound = ETrue; + aFeedback = static_cast( feedbackDown ); + iLastPenDown = + TTactilePenDownEvent( + aWgIdentifier, aWindowHandle, aEntry.iRect ); + } + // #3 + else if ( ( aPointerEvent.iType == TPointerEvent::EButton1Up )) + { + if ( iLastPenDown.iWindowGroupId == aWgIdentifier && + iLastPenDown.iWindowHandle == aWindowHandle && + iLastPenDown.iFeedbackArea == aEntry.iRect ) + { + matchFound = ETrue; + aFeedback = static_cast( feedbackUp ); + + // Can only match agains same pen down event once + iLastPenDown.Reset(); + } + } + if ( matchFound ) + { + aFeedback = static_cast(aFeedback | enablers); + } + } + return matchFound; + } + + +// --------------------------------------------------------------------------- +// Find the chunk of that application, where pointer event hit. +// +// #1 First determine the window server client connection handle (we use +// this to indentify chunk instead of window group id, because this way +// resolving works the same way also for additional window groups) +// +// #2 Go though the chunk array for finding out the correct one. +// --------------------------------------------------------------------------- +// +TInt CTactileAreaRegistry::ChunkIndexByWindowGroupId( TInt aWgIdentifier ) const + { + TInt chunkIndex = KErrNotFound; + + // #1 + TUint connectionHandle = ConnectionHandleByWgId( aWgIdentifier ); + + // #2 Iterate though chunks to find the correct one + for ( TInt chunk = 0; chunk < iChunkArray.Count() && chunkIndex == KErrNotFound; chunk++ ) + { + if ( iChunkArray[chunk].iConnectionHandle == connectionHandle ) + { + chunkIndex = chunk; + } + } + + return chunkIndex; + } + + +// --------------------------------------------------------------------------- +// Here we scan through the window group array, and return the corresponding +// connection handle in case a match is found. +// --------------------------------------------------------------------------- +// +TUint CTactileAreaRegistry::ConnectionHandleByWgId( TInt aWgIdentifier ) const + { + TUint connectionHandle = 0; + + for ( TInt i=0; i < iWgArray.Count() && !connectionHandle; i++ ) + { + if ( iWgArray[i].iWindowGroupId == aWgIdentifier ) + { + connectionHandle = iWgArray[i].iConnectionHandle; + } + } + + return connectionHandle; + } + + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_REGISTRY_HIT_TEST_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_REGISTRY_HIT_TEST_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/traces/tactilearearegistryTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/traces/tactilearearegistryTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILEAREAREGISTRYTRACES_H__ +#define __TACTILEAREAREGISTRYTRACES_H__ + +#define KOstTraceComponentID 0x2000b492 + +#define TACTILE_REGISTRY_HIT_TEST_1 0x400001 +#define TACTILE_REGISTRY_HIT_TEST_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilearearegistry/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilearearegistry/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ + + 536917138 + tactilearearegistry + + 64 + TACTILE_PERFORMANCE + + e_TACTILE_REGISTRY_HIT_TEST 1 + 1 + TACTILE_REGISTRY_HIT_TEST_1 + + ../src/tactilearearegistry.cpp + 238 + CTactileAreaRegistry + HitTestPointerEvent + + + + e_TACTILE_REGISTRY_HIT_TEST 0 + 2 + TACTILE_REGISTRY_HIT_TEST_0 + + ../src/tactilearearegistry.cpp + 263 + CTactileAreaRegistry + HitTestPointerEvent + + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/bwins/tactileclickpluginu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/bwins/tactileclickpluginu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + ?CreateClickMakerL@@YAPAVCClickMaker@@XZ @ 1 NONAME ; class CClickMaker * CreateClickMakerL(void) + ?Instance@MTactileFeedbackServer@@SAPAV1@XZ @ 2 NONAME ; class MTactileFeedbackServer * MTactileFeedbackServer::Instance(void) + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/eabi/tactileclickpluginu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/eabi/tactileclickpluginu.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +EXPORTS + _Z17CreateClickMakerLv @ 1 NONAME + _ZN22MTactileFeedbackServer8InstanceEv @ 2 NONAME + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for the click maker plugin, +* which handles key events at window server process. +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/tactileclickplugin.iby CORE_IBY_EXPORT_PATH(mw, tactileclickplugin.iby) + +#ifndef TOOLS + +PRJ_MMPFILES +tactileclickplugin.mmp + +#endif // TOOLS diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/group/tactileclickplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/group/tactileclickplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for the click maker plugin, which +* handles key events at window server process. +* Part of: Tactile Feedback. +* +*/ + + +#include +#include + +TARGET tactileclickplugin.dll +TARGETTYPE DLL +UID 0x10004F63 0x2000B493 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactileclickplugin.cpp +SOURCE tactilefeedbackserver.cpp + +USERINCLUDE ../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../inc + +LIBRARY euser.lib +LIBRARY tactilearearegistry.lib +LIBRARY tactilefeedbackresolver.lib + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/inc/tactileclickplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/inc/tactileclickplugin.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The click maker plugin, which +* handles key events at window server process. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILECLICKPLUGIN_H +#define C_TACTILECLICKPLUGIN_H + + + +#include + +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif //SYMBIAN_ENABLE_SPLIT_HEADERS + +#include + +#include "tactilefeedbackserver.h" + +class RTactileFeedback; +class CTactileAreaRegistry; + + +/** + * The click maker plugin for triggering tactile feedback. + * + * Tactile feedback is generated on each pointer down event, in case the + * pointer event hit some area on screen where feedback is enabled. + * Feedback triggering has tight latency requirements, and thus this + * click maker plugin's purpose is to enable feedback triggering from + * window server process (instead of application process when the pointer + * event arrives there). + * + * Feedback areas are kept in the Area Registry, and this plug-ins task is + * to pass incoming pointer events to the Area registry so that hit tests + * can be done to see if any feedback area was hit or not. + * + * The implementation of this plugin relies to the fact that OtherEvent + * -function is called with the pointer event + window identifier and + * window group identifier as additional parameters (these are Symbian + * changes compared to the documented behaviour). + * + * This plug-in is also responsible of providing + * Tactile Feedback AnimDll API for AnimDll plug-ins. That API is + * designed for supporting direct feedback triggering from AnimDll plug-ins, + * and it needs to be implemented by this plug-in because this is the only + * component in Tactile Feedback subsystem that is guaranteed to run + * in the window server's process (other components have been designed in + * such way that they can be moved elsewhere in case necessary). + * + * @lib N/A + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CTactileClickPlugin ): + public CClickMaker, + public MTactileFeedbackServer + { +public: + + static CTactileClickPlugin* NewL(); + + virtual ~CTactileClickPlugin(); + +// from base class CClickMaker + + /** + * From CClickMaker. + * This function is called by the window server whenever there is a + * key event, to generate the sound. + * + * The key events are not used by this plugin actually, because this + * plug-in's purpose is to handle only pointer events. + * + * @since S60 v5.0 + * @param aType - The type of the key event. + * @param aEvent - The key event details. + */ + void KeyEvent( TEventCode aType,const TKeyEvent& aEvent ); + + /** + * From CClickMaker. + * This function is called by the window server whenever there is a + * pointer event, to generate the sound. + * + * Not used by this plug-in because there is not enough information in + * the pointer event for resolving the actual area and window where + * pointer event was hit. Intead pointer events are handled in + * OtherEvent -function. + * + * @since S60 v5.0 + * @param aEvent - The pointer event details. + */ + void PointerEvent( const TPointerEvent& aEvent ); + + /** + * From CClickMaker. + + * This function is a "future expansion" of the original click maker API, + * and it has been taken into use by this plugin for getting more + * information about the pointer event than what is possible to pass as + * parameter to PointerEvent -function. + * + * @since S60 v5.0 + * @param aType - The type of the event. + * @param aParam - Pointer to data package containing the pointer event, + * window identifier where pointer event hit, and window + * group identifier of the window group where the window + * belongs to. + */ + void OtherEvent( TInt aType, TAny* aParam=NULL ); + + /** + * From CClickMaker. + * Implemented to enable this plug-in to communicate with the window + * server client. + * + * Area registry management communication (such as creating or closing + * an application) is communicated through this function. + * + * In practice communication is done between this plug-in, and + * Tactile Feedback Client API implementation. + * + * @since S60 v5.0 + * @param aOpcode - Opcode of the command sent by Client API + * @param aArgs - Pointer to the data sent by client. + */ + TInt CommandReplyL( TInt aOpcode, TAny* aArgs ); + + +// from base class MTactileFeedbackServer + + /** + * From MTactileFeedbackServer. + * Direct feedback service for Anim Dll plugins. + * + * @since S60 v5.0 + * @param aType - Logical feedback type to play. + */ + void InstantFeedback( TTouchLogicalFeedback aType ); + +private: + + CTactileClickPlugin(); + + void ConstructL(); + + /** + * Handles data parsing when new client connects to this plugin. + * + * Actual functionality is implemented in Tactile Area Registry. + * + * @param aArgs - Pointer to the data sent by client. + */ + void HandleConnectL( TAny* aArgs ); + + /** + * Handles data parsing when client disconnects itself. In practice + * this happens when application is closed. + * + * Actual functionality is implemented in Tactile Area Registry. + * + * @param aArgs - Pointer to the data sent by client. + */ + void HandleDisconnect( TAny* aArgs ); + + /** + * Handles direct feedback request from Tactile Client API. + * + * In practice this function only parses the data so that the + * logical feedback type is known. After that feedback type is passed + * to Tactile Feedback Resolver, which will then play direct feedback + * (or block the request if feedback is not enabled on the moment). + * + * @param aArgs - Pointer to the data sent by client. + * @return KErrNone if operation succeeded, otherwise one of standand + * Symbian OS error codes. + */ + TInt HandleImmediateFeedback( TAny* aArgs ); + + +private: // data + + /** + * Access to tactile feedback server, which actually produces + * the feedback. + * Own. + */ + RTactileFeedback iFeedback; + + /** + * Access to tactile area registry, which stores feedback areas and is + * used for hit testing the incoming pointer events against registry + * content. + * Own. + */ + CTactileAreaRegistry* iAreaRegistry; + + /** + * Flag to indicate whether resolver construction has been attempted + * already. We store this information to avoid unnecessary overhead at + * boot when something is missing and it just is not possible to + * construct resolver. + */ + TBool iResolverConstructionAttempted; + }; + + +#endif // C_TACTILECLICKPLUGIN_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/rom/tactileclickplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/rom/tactileclickplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the IBY file for Tactile Click Plugin. +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILECLICKPLUGIN_IBY +#define TACTILECLICKPLUGIN_IBY + +#include + +// ============================================================================= +// Tactile Click Plugin +// ============================================================================= +file=ABI_DIR\BUILD_DIR\tactileclickplugin.dll SHARED_LIB_DIR\tactileclickplugin.dll + +#endif // TACTILECLICKPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/src/tactileclickplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/src/tactileclickplugin.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The click maker plugin, which +* handles key events at window server process. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include + +#include "tactileclickplugin.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactileclickpluginTraces.h" +#endif + +// ======== MEMBER FUNCTIONS ======== + +CTactileClickPlugin::CTactileClickPlugin() + { + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::ConstructL() + { + TRACE( "CTactileClickPlugin::ConstructL - Begin" ); + + // Notice that we intentionally don't connect to feedback server here. + // This is because some players may try to connect to such servers, + // which don't exist yet when click plugin is loaded. + iAreaRegistry = CTactileAreaRegistry::NewL(); + + // We need to store ourselves to thead local storage, so that + // Anim Dll plugins can access the feedback functionality + Dll::SetTls( this ); + + TRACE( "CTactileClickPlugin::ConstructL - End" ); + } + +// --------------------------------------------------------------------------- +// We really have to trap ConstructL, because construction of click maker +// plug-in must not fail (otherwise WSERV will panic, resulting in KERN 4 and +// re-boot of whole device). +// --------------------------------------------------------------------------- +// +CTactileClickPlugin* CTactileClickPlugin::NewL() + { + CTactileClickPlugin* self = new( ELeave ) CTactileClickPlugin; + TRAP_IGNORE( self->ConstructL() ); + return self; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTactileClickPlugin::~CTactileClickPlugin() + { + delete iAreaRegistry; + iFeedback.Close(); + Dll::SetTls( NULL ); + } + +// --------------------------------------------------------------------------- +// From class CClickMaker. +// No implementation needed +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::KeyEvent( + TEventCode /*aType*/, const TKeyEvent& /*aEvent*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class CClickMaker. +// No implementation needed +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::PointerEvent( const TPointerEvent& /*aEvent*/ ) + { + } + +// --------------------------------------------------------------------------- +// From class CClickMaker. +// +// Notice that we really have to check iFeedback handle and iAreaRegistry +// pointer here, because click maker construction must not fail +// (otherwise WSERV will panic) +// +// We handle three types of events here: +// +// 1. Pointer events coming from window server: For these we do hit testing, +// and use RTactileFeedback to play feedback accordingly. +// +// 2. Window group open events: These ones we pass to area registry for +// bookkeeping. +// +// 3. Window group close events: These ones we also pass to area registry, so +// that it can update its bookkeeping. +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::OtherEvent( TInt aType, TAny* aParam ) + { + // 1. Pointer events + if ( aParam && aType == EEventPointer && iFeedback.Handle() && iAreaRegistry ) + { + TPointerEventData* p = static_cast ( aParam ); + + // Extract pointer event from the data given by wserv + TPointerEvent pointerEvent = p->iPointerEvent; + + // Handle button down and button up events. + if ( pointerEvent.iType == TPointerEvent::EButton1Down || + pointerEvent.iType == TPointerEvent::EButton1Up ) + { + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_PEN_EVENT_1, "e_TACTILE_CLICK_PLUGIN_PEN_EVENT 1"); + + // Adjust position so that it is window -relative + pointerEvent.iPosition = ( p->iCurrentPos - p->iWindowOrigin ); + + TInt feedback = + iAreaRegistry->HitTestPointerEvent( + pointerEvent, + p->iWindowGroupId, + p->iClientHandle ); + + // There is extra vibra- and audio information in top two bits of + // feedback type. + TBool playVibra( EFalse ); + TBool playAudio( EFalse ); + + if ( pointerEvent.iType == TPointerEvent::EButton1Down ) + { + playVibra = ( ( feedback & KTactileVibraBitDown ) != 0); + playAudio = ( ( feedback & KTactileAudioBitDown ) != 0); + } + else + { + playVibra = ( ( feedback & KTactileVibraBitUp ) != 0); + playAudio = ( ( feedback & KTactileAudioBitUp ) != 0); + } + + // Clear upper two bytes completely + feedback &= 0xffff; + + if ( feedback != ETouchFeedbackNone ) + { + iFeedback.PlayFeedback( + static_cast( feedback ), + playVibra, + playAudio ); + } + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_PEN_EVENT_0, "e_TACTILE_CLICK_PLUGIN_PEN_EVENT 0"); + } + } + // 2. Window group open events + else if ( aType == EEventGroupWindowOpen && iAreaRegistry ) + { + TGroupWindowOpenData* data = static_cast( aParam ); + + iAreaRegistry->HandleWindowGroupCreated( + data->iIdentifier, + data->iClient ); + } + // 3. Window group close events. + else if ( aType == EEventGroupWindowClose && iAreaRegistry ) + { + TInt identifier = reinterpret_cast( aParam ); + + iAreaRegistry->HandleWindowGroupClosed( + identifier ); + } + } + +// --------------------------------------------------------------------------- +// From class CClickMaker. +// This is run when client calls RSoundPlugin::CommandReply -function. +// +// Handling of individual commands has been moved to dedicated functions, +// because data handling requires some effort and relively complex code. +// This is due to the mistake in CClickMaker API design, as the data is +// not delivered in the same format as it was passed to RSoundPlugin on +// client side (client gives data in descriptor, but here the descriptor +// needs to be re-built from TAny* pointer, and in addition the lenght +// of data needs to be known based on command id). +// +// Leaving here causes RSoundPlugin::CommandReply to return with an error +// code on client side. It is thus important that we leave in case +// command ETactileOpCodeConnect fails, because that way client knows +// that feedback won't work and does not attempt to do updates in vain. +// --------------------------------------------------------------------------- +// +TInt CTactileClickPlugin::CommandReplyL( TInt aOpcode, TAny* aArgs ) + { + TRACE2( "CTactileClickPlugin::OtherEvent - Begin, opCode = %d", aOpcode ); + + TInt errCode = KErrNone; + + switch ( aOpcode ) + { + case ETactileOpCodeConnect: + HandleConnectL( aArgs ); + break; + case ETactileOpCodeDisconnect: + HandleDisconnect( aArgs ); + break; + case ETactileOpCodeImmediateFeedback: + errCode = HandleImmediateFeedback( aArgs ); + break; + default: + break; + } + + TRACE( "CTactileClickPlugin::OtherEvent - End" ); + + return errCode; + }; + +// --------------------------------------------------------------------------- +// From class MTactileFeedbackServer +// +// This function handles instant feedback requests originating inside +// window server (i.e. From Anim Dll plugins). +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::InstantFeedback( TTouchLogicalFeedback aType ) + { + TRACE( "CTactileClickPlugin::InstantFeedback - Begin" ); + + if ( iFeedback.Handle() ) + { + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_1, "e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API 1"); + + iFeedback.PlayFeedback( aType, ETrue, ETrue ); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_0, "e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API 0"); + } + } + +// --------------------------------------------------------------------------- +// Handling of connection requests from clients. +// +// #1 Try to connect to Tactile Feedback server in case it is not yet created, +// and creation has already been attempted (this is an optimization in case +// there is something wrong in the device so that construction cannot +// succeed). +// +// #2 Convert the data and pass connect .command to Area Registry +// +// #3 In case area registry or server connection does not exist, then leave +// so that client knows that feedback is not in use. +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::HandleConnectL( TAny* aArgs ) + { + // #1 Try to connct to RTactileFeedback first (if not yet connected) + if ( !iFeedback.Handle() ) + { + // Try to connect to Tactile Feedback server now when first client + // has connected. + User::LeaveIfError( iFeedback.Connect() ); + } + + // #2 + if ( aArgs && iAreaRegistry && iFeedback.Handle() ) + { + TInt* tmpInt = reinterpret_cast( aArgs ); + + TInt dataSize = sizeof( TTactileFeedbackConnectData ); + + TPtrC8 tmpConnectData( reinterpret_cast( tmpInt ), dataSize ); + + TTactileFeedbackConnectData clientData; + + TPckg dataBuf (clientData); + + dataBuf.Copy( tmpConnectData ); + + iAreaRegistry->HandleConnectL( clientData ); + } + else + { + // #3 Fail connection if everything is not in place. This way client + // will not waste effort doing updates in vain. + User::Leave( KErrGeneral ); + } + } + +// --------------------------------------------------------------------------- +// Handle disconnection requests from clients. +// +// Here we just convert the data and pass command to Area Registry +// --------------------------------------------------------------------------- +// +void CTactileClickPlugin::HandleDisconnect( TAny* aArgs ) + { + if ( aArgs && iAreaRegistry ) + { + TInt* tmpInt = reinterpret_cast( aArgs ); + + TInt dataSize = sizeof( TTactileFeedbackDisconnectData ); + + TPtrC8 tmpDisconnectData( reinterpret_cast( tmpInt ), dataSize ); + + TTactileFeedbackDisconnectData clientData; + + TPckg dataBuf (clientData); + + dataBuf.Copy( tmpDisconnectData ); + + iAreaRegistry->HandleDisconnect( clientData ); + } + } + +// --------------------------------------------------------------------------- +// Handling of immediate feedback, that originates from client application +// (See InstantFeedback function for handling of feedback that originates +// from inside window server) +// +// We don't need to do any state checks (call in progress) etc. here, +// because Feedback Server will do that anyway. Notice that we rely +// on the client API so that it does not send direct feedback in case client +// application has disabled feedback from itself. +// --------------------------------------------------------------------------- +// +TInt CTactileClickPlugin::HandleImmediateFeedback( TAny* aArgs ) + { + if ( aArgs && iFeedback.Handle() ) + { + TTactileFeedbackImmediateData* data = + reinterpret_cast( aArgs ); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_1, "e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API 1"); + + iFeedback.PlayFeedback( data->iFeedbackType, + data->iPlayVibra, + data->iPlayAudio ); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_0, "e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API 0"); + } + + return KErrNone; + } + +// ======== GLOBAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Function with this signature needs to be the first exported function +// in click maker plugin DLLs. +// +// Constructs and returns an instance to tactile click maker plugin. +// --------------------------------------------------------------------------- +// +EXPORT_C CClickMaker* CreateClickMakerL() + { + TRACE( "CreateClickMakerL" ); + return CTactileClickPlugin::NewL(); + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/src/tactilefeedbackserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/src/tactilefeedbackserver.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the method for accessing +* MTactileFeedbackServer -instance +* Part of: Tactile Feedback. +* +*/ + + +#include +#include "tactileclickplugin.h" + +#include "tactilefeedbackserver.h" + + + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// Here we really need to do the casting to CTactileClickPlugin, and NOT +// to MTactileFeedbackServer. It seems to be that static_cast does not work +// in case we try to cast a pointer to some base class, which is not the +// first one in the inheritance list. +// --------------------------------------------------------------------------- +EXPORT_C MTactileFeedbackServer* MTactileFeedbackServer::Instance() + { + TRACE("MTactileFeedbackServer::Instance"); + + CTactileClickPlugin* clickPlugin = NULL; + + TAny* tmpPtr = Dll::Tls(); + + if ( tmpPtr ) + { + clickPlugin = static_cast( tmpPtr ); + } + + return clickPlugin; + } + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,8 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_0=0x6 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_1=0x5 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_0=0x4 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_1=0x3 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_PEN_EVENT_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLICK_PLUGIN_PEN_EVENT_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/traces/tactileclickpluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/traces/tactileclickpluginTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,20 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILECLICKPLUGINTRACES_H__ +#define __TACTILECLICKPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2000b493 + +#define TACTILE_CLICK_PLUGIN_PEN_EVENT_1 0x400001 +#define TACTILE_CLICK_PLUGIN_PEN_EVENT_0 0x400002 +#define TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_1 0x400003 +#define TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_0 0x400004 +#define TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_1 0x400005 +#define TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_0 0x400006 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactileclickplugin/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactileclickplugin/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,74 @@ + + 536917139 + tactileclickplugin + + 64 + TACTILE_PERFORMANCE + + e_TACTILE_CLICK_PLUGIN_PEN_EVENT 1 + 1 + TACTILE_CLICK_PLUGIN_PEN_EVENT_1 + + ../src/tactileclickplugin.cpp + 134 + CTactileClickPlugin + OtherEvent + + + + e_TACTILE_CLICK_PLUGIN_PEN_EVENT 0 + 2 + TACTILE_CLICK_PLUGIN_PEN_EVENT_0 + + ../src/tactileclickplugin.cpp + 161 + CTactileClickPlugin + OtherEvent + + + + e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API 1 + 3 + TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_1 + + ../src/tactileclickplugin.cpp + 242 + CTactileClickPlugin + InstantFeedback + + + + e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API 0 + 4 + TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_SERVER_API_0 + + ../src/tactileclickplugin.cpp + 246 + CTactileClickPlugin + InstantFeedback + + + + e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API 1 + 5 + TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_1 + + ../src/tactileclickplugin.cpp + 343 + CTactileClickPlugin + HandleImmediateFeedback + + + + e_TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API 0 + 6 + TACTILE_CLICK_PLUGIN_INSTANT_FEEDBACK_CLIENT_API_0 + + ../src/tactileclickplugin.cpp + 349 + CTactileClickPlugin + HandleImmediateFeedback + + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/bwins/touchfeedbacku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/bwins/touchfeedbacku.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,12 @@ +EXPORTS + ?CreateInstanceL@MTouchFeedback@@SAPAV1@XZ @ 1 NONAME ; class MTouchFeedback * MTouchFeedback::CreateInstanceL(void) + ?DestroyInstance@MTouchFeedback@@SAXXZ @ 2 NONAME ; void MTouchFeedback::DestroyInstance(void) + ?Instance@MTouchFeedback@@SAPAV1@XZ @ 3 NONAME ; class MTouchFeedback * MTouchFeedback::Instance(void) + ?NewL@CTouchFeedbackAdaptation@@SAPAV1@XZ @ 4 NONAME ; class CTouchFeedbackAdaptation * CTouchFeedbackAdaptation::NewL(void) + ?ControlVisibilityChanged@CTouchFeedbackAdaptation@@QAEXPBVCCoeControl@@@Z @ 5 NONAME ; void CTouchFeedbackAdaptation::ControlVisibilityChanged(class CCoeControl const *) + ?LayoutChanged@CTouchFeedbackAdaptation@@QAEXXZ @ 6 NONAME ; void CTouchFeedbackAdaptation::LayoutChanged(void) + ?AddFeedback@CFeedbackSpec@@QAEHW4TTouchEventType@@W4TTouchLogicalFeedback@@@Z @ 7 NONAME ; int CFeedbackSpec::AddFeedback(enum TTouchEventType, enum TTouchLogicalFeedback) + ?GetFeedbackSpec@CFeedbackSpec@@QAEXAAV?$RArray@UTTactileFbItem@@@@@Z @ 8 NONAME ; void CFeedbackSpec::GetFeedbackSpec(class RArray &) + ?New@CFeedbackSpec@@SAPAV1@XZ @ 9 NONAME ; class CFeedbackSpec * CFeedbackSpec::New(void) + ?AddFeedback@CFeedbackSpec@@QAEHW4TTouchEventType@@W4TTouchLogicalFeedback@@W4TTouchFeedbackType@@@Z @ 10 NONAME ; int CFeedbackSpec::AddFeedback(enum TTouchEventType, enum TTouchLogicalFeedback, enum TTouchFeedbackType) + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/cenrep/2000B494.txt Binary file tactilefeedback/tactilefeedbackclient/cenrep/2000B494.txt has changed diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/conf/tactilefeedback.confml Binary file tactilefeedback/tactilefeedbackclient/conf/tactilefeedback.confml has changed diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/conf/tactilefeedback_2000B494.crml Binary file tactilefeedback/tactilefeedbackclient/conf/tactilefeedback_2000B494.crml has changed diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/eabi/touchfeedbacku.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/eabi/touchfeedbacku.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _ZN14MTouchFeedback15CreateInstanceLEv @ 1 NONAME + _ZN14MTouchFeedback15DestroyInstanceEv @ 2 NONAME + _ZN14MTouchFeedback8InstanceEv @ 3 NONAME + _ZN24CTouchFeedbackAdaptation4NewLEv @ 4 NONAME + _ZTI24CTouchFeedbackAdaptation @ 5 NONAME ; ## + _ZTV24CTouchFeedbackAdaptation @ 6 NONAME ; ## + _ZN24CTouchFeedbackAdaptation24ControlVisibilityChangedEPK11CCoeControl @ 7 NONAME + _ZN24CTouchFeedbackAdaptation13LayoutChangedEv @ 8 NONAME + _ZN13CFeedbackSpec11AddFeedbackE15TTouchEventType21TTouchLogicalFeedback @ 9 NONAME + _ZN13CFeedbackSpec3NewEv @ 10 NONAME + _ZTI13CFeedbackSpec @ 11 NONAME ; ## + _ZTV13CFeedbackSpec @ 12 NONAME ; ## + _ZN13CFeedbackSpec11AddFeedbackE15TTouchEventType21TTouchLogicalFeedback18TTouchFeedbackType @ 13 NONAME + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Tactile Feedback Client API +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// Generic configuration interface for component cenrep settings +../conf/tactilefeedback.confml APP_LAYER_CONFML(tactilefeedback.confml) +../conf/tactilefeedback_2000B494.crml APP_LAYER_CRML(tactilefeedback_2000B494.crml) + + +PRJ_MMPFILES +touchfeedback.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/group/touchfeedback.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/group/touchfeedback.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 Touch Feedback Client API +* implementation. +* Part of: Tactile Feedback. +* +*/ + + + +#include +#include + +TARGET touchfeedback.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000B491 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE touchfeedbackadaptation.cpp +SOURCE touchfeedback.cpp +SOURCE touchfeedbackimpl.cpp +SOURCE touchfeedbackregistry.cpp +SOURCE touchfeedbackclient.cpp +SOURCE touchfeedbackclientpanic.cpp + + +USERINCLUDE ../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE ../../inc + +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY cone.lib +LIBRARY avkon.lib +LIBRARY ws32.lib // RSoundPlugin +LIBRARY featmgr.lib // Feature Manager +LIBRARY tactilefeedbackresolver.lib + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/inc/touchfeedbackclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/inc/touchfeedbackclient.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,283 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Communication from Client API to Tactile Area Registry. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef C_TOUCHFEEDBACKCLIENT_H +#define C_TOUCHFEEDBACKCLIENT_H + +#include +#include +#include +#include +#include + +#include "touchlogicalfeedback.h" + +class CTouchFeedbackImpl; + +/** + * The class for sharing area registry with the window server. + * + * @lib touchfeedback.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CTouchFeedbackClient ): + public CBase + { +public: + /** + * Instantiation method. + * + * @since S60 5.0 + * @return New CTouchFeedbackClient instance. + */ + static CTouchFeedbackClient* NewL( CTouchFeedbackImpl& aFeedback ); + + /** + * Destructor. + * @since S60 5.0 + */ + virtual ~CTouchFeedbackClient(); + + /** + * Should be called whenever registry has changed. + * + * Causes starting of a CIdle object, so that registry updates are + * flushed to server side as soon as possible. + * @since S60 5.0 + */ + void RegistryChanged( ); + + /** + * Use to produce direct feedback immediately. + * + * @since S60 5.0 + * @param aType - The logical feedback type. + * @param aVibraOn - If ETrue then vibra feedback shall be played + * (if enabled in device). + * @param aAudioOn - If ETrue then audio feedback shall be played + * (if enabled in device). + */ + void ImmediateFeedback( TTouchLogicalFeedback aType, + TBool aVibraOn, + TBool aAudioOn ); + + /** + * Use to flush registry updates immediately. + * @since S60 5.0 + */ + void FlushUpdates(); + + /** + * Starts continuous feedback or just restarts the timeout timer if + * feedback is already started. This function can also be used to + * modify the intensity of ongoing continuous feedback if timeout + * and repeated start calls are used. + * + * @since S60 5.2 + * @param aClientHandle - Handle of a client. Handle is stored to + * prevent other clients to stop or modify + * playing feedback. + * @param aType - Type of continuous feedback. + * + * @param aIntensity - Intensity of continuous feedback. Value + * range is 0-100%. + * @param aTimeout - Timeout value, which is used to automatically + * stop continuous feedback if there's no new + * start call within the timeout time. + */ + void StartFeedback( TUint32 aClientHandle, + TTouchContinuousFeedback aType, + TInt aIntensity, + TTimeIntervalMicroSeconds32 aTimeout ); + + /** + * Modifies the intensity of continuous feedback. + * + * @since S60 5.2 + * @param aClientHandle - Handle of a client to check if caller started + * the playing continuous feedback. + * @param aIntensity - New intensity of continuous feedback. Value + * range is 0-100%. + */ + void ModifyFeedback( TUint32 aClientHandle, + TInt aIntensity ); + + /** + * Stops the continuous feedback. + * + * @since S60 5.2 + * @param aClientHandle - Handle of a client to check if caller started + * the playing continuous feedback. + */ + void StopFeedback( TUint32 aClientHandle ); + + /** + * Enables or disables audio or/and vibra feedback in whole device. + * @param aFeedbackType - Feedback types to be enabled/disabled + * defined as a bitmask combination of + * enumeration items from TTouchFeedbackType. + * + * @since S60 5.2 + * @return KErrNone, or one of standard Symbian OS error codes if + * enabling/disabling fails. + * KErrPermissionDenied - ECapabilityWriteDeviceData required + * for using this function. + */ + TInt SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ); + + /** + * Used to check enabled feedback types for the device. + * + * @since S60 5.2 + * @return TTouchFeedbackType containing enabled feedback types + * as a bitmask. + */ + TTouchFeedbackType FeedbackEnabledForDevice(); + +private: + + /** + * Start timeout timer for continuous feedback. + */ + void StartFeedbackTimer( TTimeIntervalMicroSeconds32 aTimeout ); + + /** + * Stops continuous feedback and clears timeout timer and client handle. + * Called by timeout callback function. + */ + void StopFeedbackByTimeout(); + + /** + * Timeout callback function. + */ + static TInt StopFeedbackCallback( TAny* aThis ); + +private: + + /** + * Default constructor. + */ + CTouchFeedbackClient( CTouchFeedbackImpl& aFeedback ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Callback for CIdle. When this function is called, it is time to update + * local registry content to shared memory chunk. + * + * Depending of whether feedback is actually enabled or disabled for + * this application, either UpdateRegistryToChunkL or ClearWholeChunkL + * -function shall be called. + * + * @param aPtr - Pointer to this class instance. + */ + static TInt IdleCallbackL( TAny* aPtr ); + + /** + * Updates whole area registry content to shared chunk. Called from + * IdleCallbackL when feedback is enabled for this application. + */ + void UpdateRegistryToChunkL(); + + /** + * Clears whole shared chunk so that there are no feedback areas at + * all. Called from IdleCallbackL when feedback is disabled for this + * application. + */ + void ClearWholeChunkL(); + + /** + * This is a cleanup operation that releases a semaphore in case + * a leave occurs while we have called Wait on the semaphore. + * Failing to release the semaphore (by calling "Signal" -function + * on it) would lead to deadlock in the system. + * @param aPtr - Pointer to RSemaphore. + */ + static void CleanupSemaphore( TAny* aPtr ); + +private: // data + + /** + * Connection to window server click maker plugin. + */ + RSoundPlugIn iClickPlugin; + + /** + * Area registry in shared chunk between this process and + * window server process. + */ + RChunk iChunk; + + /** + * Mutual exlusion with window server and other clients. + */ + RSemaphore iSemaphore; + + /** + * For knowing if we'll need to disconnect when this application + * is closed. + */ + TBool iConnected; + + /** + * For doing registry update as soon as possible, but not + * immediately. + * Own. + */ + CIdle* iIdle; + + /** + * Access to local area registry + * Not own. + */ + CTouchFeedbackImpl& iFeedback; + + /** + * Client interface to tactile feedback server. + * Own. + */ + RTactileFeedback iFbClient; + + /** + * Timer for continuous feedback timeout. + * Own. + */ + CPeriodic* iFeedbackTimer; + + /** + * Client handle for checking continuous is not modified or stopped by + * other clients that the one, which started it. + */ + TUint32 iClientHandle; + + /** + * Previous intensity value of an ongoing continuous feedback to prevent + * unnecessary modify calls if there's no change in intensity. Also + * new start call for ongoing feedback modifies the intensity if value + * was changed. + */ + TInt iPreviousIntensity; + }; + + +#endif // C_TOUCHFEEDBACKCLIENT_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/inc/touchfeedbackclientpanic.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/inc/touchfeedbackclientpanic.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic codes for Tactile Feedback Client. +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef T_TOUCHFEEDBACKCLIENTPANIC_H +#define T_TOUCHFEEDBACKCLIENTPANIC_H + +#include + + +// DATA TYPES +enum TTouchFeedbackClientPanic + { + // Invalid array index passed to some internal function + ETouchClientPanicArrayAccess = 0 + }; + +// FUNCTION PROTOTYPES +GLDEF_C void Panic( TTouchFeedbackClientPanic aPanic ); + + +#endif // T_TOUCHFEEDBACKCLIENTPANIC_H + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/inc/touchfeedbackimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/inc/touchfeedbackimpl.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,514 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class implements Tactile Feedback Client API +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef C_TOUCHFEEDBACKIMPL_H +#define C_TOUCHFEEDBACKIMPL_H + +#include +#include +#include + +#include "touchlogicalfeedback.h" +#include "touchfeedback.h" + + +class CTouchFeedbackRegistry; +class CTouchFeedbackClient; + + +/** + * This structure stores one index / area id pair. + * This kind of entries are stored for each control, which have + * feedback areas defined. + */ +struct TAreaIndexEntry + { + TUint32 iIndex; + TInt iAreaId; + }; + +/** + * This structure stores one control's information on client-side. + * This information includes control's visibility, dimming and feedback + * disabled information, as well as array of the feedback area + * identifiers. + * + * Notice that the client handle is stored for two reasons: Firstly + * it is an optimization to store it as this way we can avoid unnecessary + * client-server transaction (window server client-side API does not + * cache the handle). Secondly some times control's window may have been + * deleted before control removes it's feedback areas. In these situations + * we even wouldn't be able to use the control for getting the handle + * anymore. + */ +struct TControlCacheEntry + { + const CCoeControl* iControl; + TUint32 iClientHandle; + TBool iVibraDisabled; + TBool iAudioDisabled; + TBool iVisible; + TBool iDimmed; + RArray iAreaArray; + }; + +/** + * This class implements the Client API that is provided for UI Controls + * and applications. + * + * The implemented interface is defined by MTouchFeedback -class. + * + * This class' main task is to have a bookkeeping of all the controls + * that have feedback areas defined. Services such as automatic disabling + * of the feedback areas of dimmed or invisible controls are implemented + * here. + * + * @lib touchfeedback.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CTouchFeedbackImpl ): + public CBase, + public MTouchFeedback + { +public: + /** + * Instantiation method. + * + * @since S60 5.0 + * @return New CTouchFeedbackImpl instance. + */ + static CTouchFeedbackImpl* New(); + + /** + * Destructor. + * @since S60 5.0 + */ + virtual ~CTouchFeedbackImpl(); + + /** + * @see MTouchFeedback. + */ + TBool TouchFeedbackSupported(); + + /** + * @see MTouchFeedback. + */ + void SetFeedbackEnabledForThisApp( TBool aEnabled ); + + /** + * @see MTouchFeedback. + */ + TBool FeedbackEnabledForThisApp(); + + /** + * @see MTouchFeedback. + */ + TInt SetFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + TTouchLogicalFeedback aFeedbackType, + TTouchEventType aEventType ); + + + + /** + * @see MTouchFeedback. + */ + void RemoveFeedbackArea( const CCoeControl* aControl, TUint32 aIndex ); + + /** + * @see MTouchFeedback. + */ + void RemoveFeedbackForControl( const CCoeControl* aControl ); + + /** + * @see MTouchFeedback. + */ + void ChangeFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aNewRect ); + + /** + * @see MTouchFeedback. + */ + void ChangeFeedbackType( const CCoeControl* aControl, + TUint32 aIndex, + TTouchLogicalFeedback aNewType ); + + /** + * @see MTouchFeedback. + */ + void MoveFeedbackAreaToFirstPriority( const CCoeControl* aControl, + TUint32 aIndex ); + + /** + * @see MTouchFeedback. + */ + void FlushRegistryUpdates( ); + + /** + * @see MTouchFeedback. + */ + void InstantFeedback( TTouchLogicalFeedback aType ); + + /** + * @see MTouchFeedback. + */ + void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType ); + + /** + * @see MTouchFeedback. + */ + TBool ControlHasFeedback( const CCoeControl* aControl ); + + /** + * @see MTouchFeedback. + */ + TBool ControlHasFeedback( const CCoeControl* aControl, TUint32 aIndex ); + + /** + * @see MTouchFeedback. + */ + void EnableFeedbackForControl( + const CCoeControl* aControl, TBool aEnable ); + + /** + * @see MTouchFeedback. + */ + void EnableFeedbackForControl( const CCoeControl* aControl, + TBool aEnableVibra, + TBool aEnableAudio ); + + /** + * @see MTouchFeedback. + */ + virtual void SetFeedbackEnabledForThisApp( TBool aVibraEnabled, + TBool aAudioEnabled ); + +public: + /** + * This function provides a way for getting the registry content. + * + * Used by CTouchFeedbackClient for listing all the registry + * areas, so that they can be put to shared memory. + * + * @since S60 5.0 + */ + RPointerArray* RegistryArray(); + + /** + * This function can be used for getting the number of areas in the + * registry. + * + * @since S60 5.0 + * @param aAreaCount - The total number of areas in the registry. + * @param aWindowCount - Number of different windows is returned here. + */ + void GetAreaCount( TInt& aAreaCount, TInt& aWindowCount ); + + /** + * This should be called for informing + * that given control's state (i.e. visiblity or dimming status) + * has been changed. This way Tactile FW knows to disable or enable + * the feedback for that control again. + * + * @since S60 5.0 + * @param aControl - Pointer to the control, which visiblity + * or dimming status has changed. + */ + void ControlVisibilityChanged( const CCoeControl* aControl ); + + /** + * This should be called when the layout is changed. + * + * @since S60 5.0 + * The motivation is to disable this application's feedback areas + * for this application in case pen usage is not supported in current + * layout. + */ + void LayoutChanged(); + +public: // new API functions since 5.2, defined in MTouchFeedback + /** + * @see MTouchFeedback. + */ + TBool FeedbackEnabledForThisApp( TTouchFeedbackType aFeedbackType ); + + /** + * @see MTouchFeedback. + */ + void StartFeedback( const CCoeControl* aControl, + TTouchContinuousFeedback aType, + const TPointerEvent* aPointerEvent, + TInt aIntensity, + TTimeIntervalMicroSeconds32 aTimeout ); + + /** + * @see MTouchFeedback. + */ + void ModifyFeedback( const CCoeControl* aControl, + TInt aIntensity ); + + /** + * @see MTouchFeedback. + */ + void StopFeedback( const CCoeControl* aControl ); + + /** + * @see MTouchFeedback. + */ + TInt SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ); + + /** + * @see MTouchFeedback. + */ + TTouchFeedbackType FeedbackEnabledForDevice(); + + /** + * @see MTouchFeedback. + */ + void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + const TPointerEvent& aPointerEvent ); + + /** + * @see MTouchFeedback. + */ + TInt SetFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + CFeedbackSpec* aFeedbackSpec ); + + /** + * @see MTouchFeedback. + */ + void InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + TTouchFeedbackType aFeedbackType, + const TPointerEvent& aPointerEvent ); + +private: + /** + * Constructor. + */ + CTouchFeedbackImpl(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Actual functionality of setting a feedback area. + * + * The API function SetFeedbackArea does the basic parameter checks and + * runs this function under trap harness so that we can leave here. + * + * @see MTouchFeedback. + */ + void DoSetFeedbackAreaL( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + CFeedbackSpec* aSpec, + TUint32 aClientHandle ); + + + /** + * Finds window from the registry if it exists. + * + * Returns an index to iResolverArray, or KErrNotFound if + * there is no entry for the window yet. + * + * @since S60 5.0 + * @param aWindowHandle - The window id to find from the array + * @return KErrNotFound if an area with given ID is not found from the registry. + */ + TInt FindWindowFromRegistry( TUint aWindowHandle ); + + /** + * Generates a unique identifier inside this application process. + * + * This is the id that is used to distinguish the area registry + * entries from each other. + * + * @since S60 5.0 + * @return Unique identifier. + */ + TUint GenerateUniqueIdL(); + + /** + * Can be used to check whether feedback area with given id exists or not. + * + * This is as helper function when generating unique identifiers for + * new feedback areas. + * + * @since S60 5.0 + * @return ETrue if feedback area with given identifier exists already. + * EFalse otherwise. + */ + TBool FeedbackAreaExists( TUint aAreaId ); + + /** + * Returns the client handle of the window, where given control + * is located. Client handle is either directly casted from first + * window-owning control's address, or then asked from window + * server. + * + * @since S60 5.0 + * @param aControl - Pointer to the control. + * @return Client handle of the window where given control is. + */ + TUint32 ClientHandle( const CCoeControl* aControl ); + + /** + * Finds given control from the cache. + * + * @since S60 5.0 + * @param aControl - Pointer to the control, which is searched + * @return The position in cache array, where searhed entry is found, + * or KErrNotFound if it is not found. + */ + TInt FindControlFromCache( const CCoeControl* aControl ); + + + /** + * Finds specific feedback area from control cache. + * + * @since S60 5.0 + * @param aControl - Pointer to the control. + * @param aIndex - Area index (given by client) + * @param aCacheIndex - If control is found, then index to control cache is + * returned here. + * @param aAreaIndex - If area is found, then index to area array in + * corresponding control cache entry is returned + * here. + */ + void FindAreaFromCache( const CCoeControl* aControl, + TUint32 aIndex, + TInt& aCacheIndex, + TInt& aAreaIndex ); + + + /** + * Removes control with given index number from the control cache. + * + * @since S60 5.0 + * @param aControlIndex - Index number of the control in the control + * array. + */ + void RemoveControlFromCache( TInt aControlIndex ); + + /** + * Can be used for querying, whether control's areas should be active + * according to it's recorced dimming-, visibility-, and feedback + * disabling status. + * + * @since S60 5.0 + * @param aControlIndex - Index number of the control in the control + * array. + * @return ETrue if control's areas should be active, EFalse otherwise. + */ + TBool ControlsAreasActive( TInt aControlIndex ); + + /** + * Can be used for disabling or enabling control's feedback areas + * in the registry. + * + * This function only modifies the registry, and not the control cache. + * + * @since S60 5.0 + * @param aControlIndex - Index number of the control in the control + * array. + * @param aEnableVibra - New disable / enable status for vibra + * @param aEnableAudio - New disable / enable status for audio + * @param aVisible - Visibility status of the control. If + * control is invisible, it's feedback areas + * will be temporarily removed from the + * registry. + */ + void DoEnableControlsAreasInRegistry( + TInt aControlIndex, + TBool aEnableVibra, + TBool aEnableAudio, + TBool aVisible ); + +private: // data + + /** + * Array of area registries. There is one entry for each window. + * Own. + */ + RPointerArray iRegistryArray; + + /** + * The id what was given to the area that was last added to the array. + */ + TUint iCurrentId; + + /** + * We maintain a bookkeeping to know in case the currently used + * feedback area id has already reached its maximum value at + * least once. This way we save some time for e.g. during boot-up + * when plenty of areas are added to the registry. + */ + TBool iCurrentIdCounterRotated; + + /** + * Pointer to client, used to inform it about registry changes. + * Own. + */ + CTouchFeedbackClient* iClient; + + /** + * Array of controls and their feedback area ids. This way users of the + * API don't have to store the ids themselves. + */ + RArray iControlCache; + + /** + * Used to store the status of audio feedback for this application. + */ + TBool iAudioEnabledForThisApp; + + /** + * Used to store the status of vibra feedback for this application. + */ + TBool iVibraEnabledForThisApp; + + /** + * For bookkeeping about feedback areas. We need this information for + * recognizing the situation when we cannot add another area to the + * registry anymore (for e.g. due to Id generation problem). + */ + TInt iNbOfFeedbackAreas; + + /** + * For bookkeeping wheater pen is enabled in current layout or not. This + * way we can optimize layout change handling so that we only react + * to changes from non-pen enabled to pen enabled layout and vice versa, + * but do nothing when layout changes without effect to pen support. + */ + TBool iPenEnabled; + }; + + + +#endif // C_TOUCHFEEDBACKIMPL_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/inc/touchfeedbackregistry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/inc/touchfeedbackregistry.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Area registry for one window. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TOUCHFEEDBACKREGISTRY_H +#define C_TOUCHFEEDBACKREGISTRY_H + + + +#include +#include +#include + +#include "touchlogicalfeedback.h" + + +/** + * Area registry entry + * + * There is one entry like this for each area that has been + * added to the registry. + */ +struct TFeedbackEntry + { + TUint iId; + TRect iRect; + TTouchLogicalFeedback iFeedbackTypeDown; + TTouchFeedbackType iFeedbackDown; + TTouchLogicalFeedback iFeedbackTypeUp; + TTouchFeedbackType iFeedbackUp; + TTouchEventType iEventType; + TBool iVibraEnabled; + TBool iAudioEnabled; + TBool iVisible; + }; + +/** + * Registry entry for one window. + * + * This class maintains area registry for one window. It offers + * services for adding, removing and mofidying areas in the + * registry, as well as resolving whether a pointer event + * hit any area on the registry or not. + * + * @lib N/A (no exported functions) + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CTouchFeedbackRegistry ): + public CBase + { + + +public: + + /** + * Instantiation mehtod + * + * @since S60 5.0 + * @param aWindowHandle - The Id of the window, where this registry is + * associated. + */ + static CTouchFeedbackRegistry* NewL( TUint aWindowHandle ); + + + virtual ~CTouchFeedbackRegistry(); + + /** + * Adds feedback area to registry. + * + * @param aRect - The feedback area rectangle + * @param aFeedbackType - The logical feedback type given + * @param aEventType - The pointer event type that triggers + * the feedback + * @param aId - The unique identifier for this registry area + * @param aVibraEnabled - If ETrue is given, then vibra feedback is + * enabled for the added area. + * @param aAudioEnabled - If ETrue is given, then audio feedback is + * enabled for the added area. + * @param aVisible - If EFalse is given, then the whole area will + * not be put to the registry. The information is + * still stored on client-side so that area can + * be added in case control becomes visible. + */ + void AddFeedbackAreaL( + TRect aRect, + TTouchLogicalFeedback aFeedbackTypeDown, + TTouchFeedbackType aFeedbackDown, + TTouchLogicalFeedback aFeedbackTypeUp, + TTouchFeedbackType aFeedbackUp, + TTouchEventType aEventType, + TUint aId, + TBool aVibraEnabled, + TBool aAudioEnabled, + TBool aVisible ); + + /** + * Removes feedback area from the registry. + * + * @param aId - Identifier of the feedback area to be removed. + */ + void RemoveFeedbackArea( TUint aId ); + + /** + * Changes feedback area in the registry. + * + * @param aId - Identifier of the feedback area to be changed. + * @param aNewRect - New feedback area rectangle. + * @return ETrue the given area was found, and if it's feedback type + * really changed. + * (in practice this means that changes need to be + * updated to server). + * EFalse otherwise. + */ + TBool ChangeFeedbackArea( + TUint aId, + TRect aNewRect ); + + /** + * Changes feedback type for given area in the registry. + * + * @param aId - Identifier of the feedback area to be changed. + * @param aNewFeedbackTypeDown - New logical feedback type for down event. + * @param aNewFeedbackTypeUp - New logical feedback type for up event. + * @return ETrue the given area was found, and if it really changed. + * (in practice this means that changes need to be + * updated to server). + * EFalse otherwise. + */ + TBool ChangeFeedbackType( + TUint aId, + TTouchLogicalFeedback aNewFeedbackTypeDown, + TTouchLogicalFeedback aNewFeedbackTypeUp ); + + /** + * Makes the given feedback area a first priority area in this window + * @param aId - The identifier of the area, which shall be prioritized. + * @return KErrNotFound if an area with given ID is not found from the registry. + */ + TInt MoveFeedbackAreaToFirstPriority( TUint aId ); + + /** + * Enables or disables given feedback area. This does not change area's + * actual feedback type. + * @param aId - The identifier of the area, which feedback shall be + * enabled / disabled. + * @param aVibraEnabled - Give ETrue to enable vibra feedback, and + * EFalse to disable vibra feedback for this area. + * @param aAudioEnabled - Give ETrue to enable audio feedback, and + * EFalse to disable audio feedback for this area. + * @param aVisible - Visibility status of the control, who owns + * the area. + * @return ETrue if registry actually changed due to this function call. + */ + TBool SetFeedbackEnabled( TUint aId, + TBool aVibraEnabled, + TBool aAudioEnabled, + TBool aVisible ); + + /** + * Returns the window handle, where this registry is associated. + * + * @return Window handle of associated window. + */ + TUint WindowHandle() const; + + /** + * Returns count of areas in this registry + */ + TInt AreaCount(); + + RArray* WindowRegistry(); + + +private: + + + CTouchFeedbackRegistry( TUint aWindowHandle ); + + +private: // data + + /** + * Handle number of the window, to which this registry is related. + */ + TUint iWindowHandle; + + /** + * Array of area registry items in this window + */ + RArray iAreaArray; + }; + + + +#endif // C_TOUCHFEEDBACKREGISTRY_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedback.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Tactile Feedback client Instance Factory. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +#include "touchfeedback.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C MTouchFeedback* MTouchFeedback::Instance() + { + return CTouchFeedbackAdaptation::GetInstance(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C MTouchFeedback* MTouchFeedback::CreateInstanceL() + { + return CTouchFeedbackAdaptation::CreateInstanceL(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C void MTouchFeedback::DestroyInstance() + { + CTouchFeedbackAdaptation::DestroyInstance(); + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedbackadaptation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackadaptation.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This class is an adaptation class that is instantiated +* by the application framework, and that instantiates the +* actual Tactile Feedback Client implementation. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include + +#include +#include + +#include "touchfeedbackclient.h" +#include "touchfeedbackimpl.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackAdaptation::CTouchFeedbackAdaptation() + { + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackAdaptation::ConstructL() + { + TRACE("CTouchFeedbackAdaptation::ConstructL - Begin"); + + iTouchFeedback = CTouchFeedbackImpl::New(); + + TRACE("CTouchFeedbackAdaptation::ConstructL - End"); + } + + +// --------------------------------------------------------------------------- +// We store ourselves to the thread local storage here. The instance is +// accessible to clients via Instance -function. +// --------------------------------------------------------------------------- +// +EXPORT_C CTouchFeedbackAdaptation* CTouchFeedbackAdaptation::NewL() + { + CTouchFeedbackAdaptation* self = new( ELeave ) CTouchFeedbackAdaptation; + CleanupStack::PushL( self ); + self->ConstructL(); + + // Store ourselves to thread local storage + User::LeaveIfError( Dll::SetTls( self ) ); + + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackAdaptation::~CTouchFeedbackAdaptation() + { + delete iTouchFeedback; + Dll::SetTls( NULL ); + } + +// --------------------------------------------------------------------------- +// Retrieve instance from thread local storage +// --------------------------------------------------------------------------- +// +MTouchFeedback* CTouchFeedbackAdaptation::GetInstance() + { + TAny* selfPtr = Dll::Tls(); + + CTouchFeedbackAdaptation* self = + static_cast( selfPtr ); + + if ( self ) + { + return self->iTouchFeedback; + } + else + { + return NULL; + } + } + +// --------------------------------------------------------------------------- +// Create new instance and return it to caller +// +// We must have check for the case where client calls this even though +// instance exists already (in this case we only return the existing +// instance). +// --------------------------------------------------------------------------- +// +MTouchFeedback* CTouchFeedbackAdaptation::CreateInstanceL() + { + // Use current instance if it exists + MTouchFeedback* feedback = GetInstance(); + + // If current instance does not exist, then create a new one + if ( !feedback ) + { + CTouchFeedbackAdaptation* tmp = NewL(); + + feedback = tmp->GetInstance(); + } + + return feedback; + } + +// --------------------------------------------------------------------------- +// Destroy ourselves if we are found at thread local storage (tls) +// +// Notice that tls content does not need to be zeroed because that is already +// done in the destructor. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackAdaptation::DestroyInstance() + { + TAny* selfPtr = Dll::Tls(); + + CTouchFeedbackAdaptation* self = + static_cast( selfPtr ); + + if ( self ) + { + delete self; + } + } + +// --------------------------------------------------------------------------- +// Empty implementation, as this function is no longer in use. +// (Control visibility changes now handled in HandleControlStateChange) +// --------------------------------------------------------------------------- +// +EXPORT_C void CTouchFeedbackAdaptation::ControlVisibilityChanged( + const CCoeControl* /*aControl*/ ) + { + } + +// --------------------------------------------------------------------------- +// Nothing to do here, just pass the information to implementation. +// --------------------------------------------------------------------------- +// +EXPORT_C void CTouchFeedbackAdaptation::LayoutChanged( ) + { + if ( iTouchFeedback ) + { + iTouchFeedback->LayoutChanged(); + } + } + +// --------------------------------------------------------------------------- +// From class MObjectProvider. +// We have to implement this because it is pure virtual in base class. +// Return Null as we are not actually part of object provider hierarchy. +// --------------------------------------------------------------------------- +TTypeUid::Ptr CTouchFeedbackAdaptation::MopSupplyObject( TTypeUid /*aId*/ ) + { + return TTypeUid::Null(); + } + +// --------------------------------------------------------------------------- +// From class MCoeControlStateObserver. +// Here we just pass the information about control state change ahead to +// actual feedback implementation. +// --------------------------------------------------------------------------- +TInt CTouchFeedbackAdaptation::HandleControlStateChange( + CCoeControl* aControl, + TCoeState /*aState*/ ) + { + if ( iTouchFeedback ) + { + iTouchFeedback->ControlVisibilityChanged( aControl ); + } + + return KErrNone; + } + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,665 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Communication with server side implementation of +* Area Registry. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +#include +#include + +#include "touchfeedbackclient.h" +#include "touchfeedbackimpl.h" +#include "touchfeedbackregistry.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "touchfeedbackclientTraces.h" +#endif + +// Minimun and maximum sized of one shared memory chunk. +const TInt KTactileChunkInitialSize = 4096; // 4kB +const TInt KTactileChunkMaxSize = 262144; // 256kB +const TUid KTactileClickPluginUid = { 0x2000B493 }; +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTouchFeedbackClient::CTouchFeedbackClient( CTouchFeedbackImpl& aFeedback ): + iClickPlugin ( CEikonEnv::Static()->WsSession()), + iFeedback( aFeedback ) + { + } + +// --------------------------------------------------------------------------- +// We do all the initializations in the construction phase. Other option +// would be to postpone these until the first registry entry has been added. +// +// #1 Connect to our ClickPlugin +// #2 Create a shared chunk, which is used for storing this application +// process' area registry, so that it can be accessed by the window +// server. +// #3 Set window count to zero in the new chunk +// #4 Try to create a global semaphore to have mutual exclusion on chunks +// If semaphore already exists, then try to open it. +// #5 Put our chunk name to package buffer, and send it to click plugin +// so that it can open a handle to our chunk and thus access the shared +// memory. +// #6 Create a CIdle object that is used for updating the registry in shared +// memory. +// +// Notice that we will leave in case anything fails. This has to be handled +// on higher level, so that whole application launch will not fail in case +// touch feedback does not work. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::ConstructL() + { + TRACE("CTouchFeedbackClient::ConstructL - Begin"); + + // #1 Connect to click plugin + User::LeaveIfError( iClickPlugin.Construct( KTactileClickPluginUid ) ); + + TBool changable = EFalse; + + TBool loaded = iClickPlugin.IsLoaded( changable ); + + if ( !loaded ) + { + User::Leave( KErrNotSupported ); + } + + // #2 Create shared chunk + RThread me; + + TTactileFeedbackConnectData data; + + // Set window group identifier + data.iWindowGroupId = CCoeEnv::Static()->RootWin().Identifier(); + + // We use our own thread name as name for the chunk + data.iChunkName.Copy( me.Name().Right( KMaxKernelName ) ); + + // Now create the chunk + TInt err = iChunk.CreateGlobal( data.iChunkName, + KTactileChunkInitialSize, + KTactileChunkMaxSize ); + + // We have to take into account, that the chunk may already exist. + // This may happen in case we have been started (and crashed) + // once already. + if ( err == KErrAlreadyExists ) + { + User::LeaveIfError( iChunk.OpenGlobal( data.iChunkName, EFalse ) ); + } + + // #3 Set window count to zero + TInt* chunkPtr = reinterpret_cast( iChunk.Base() ); + + *chunkPtr = 0; // No entries in the chunk in the beginning + + // #4 Try to create/open global semaphore + err = iSemaphore.CreateGlobal( KTouchFeedbackSemaphore, 1 ); + + if ( err == KErrAlreadyExists ) + { + User::LeaveIfError( iSemaphore.OpenGlobal( KTouchFeedbackSemaphore ) ); + } + + // #5 Send chunk name to window server + TPckgC dataPkg ( data ); + + User::LeaveIfError( iClickPlugin.CommandReply( ETactileOpCodeConnect, + dataPkg ) ); + iConnected = ETrue; + + iFeedbackTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + + User::LeaveIfError( iFbClient.Connect() ); + + // #6 We use Standard priority so that we won't disturb the normal + // functionality of the application, but can get registry updated + // fastly enough in case the application does very plenty of + // background prosessing with active objects. + iIdle = CIdle::NewL( CActive::EPriorityStandard ); + + TRACE("CTouchFeedbackClient::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTouchFeedbackClient* CTouchFeedbackClient::NewL( CTouchFeedbackImpl& aFeedback ) + { + CTouchFeedbackClient* self = + new( ELeave ) CTouchFeedbackClient ( aFeedback ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CTouchFeedbackClient::~CTouchFeedbackClient() + { + iChunk.Close(); + iSemaphore.Close(); + + if ( iFeedbackTimer ) + { + iFeedbackTimer->Cancel(); + delete iFeedbackTimer; + } + + iFbClient.Close(); + + if ( iConnected ) + { + TTactileFeedbackDisconnectData data; + + data.iWindowGroupId = CCoeEnv::Static()->RootWin().Identifier(); + + TPckgC dataPkg ( data ); + + iClickPlugin.CommandReply( ETactileOpCodeDisconnect, dataPkg ); + } + + iClickPlugin.Close(); + + delete iIdle; + } + + +// --------------------------------------------------------------------------- +// In this function we just activate CIdle. The motivation is that this +// way we avoid updating the registry multiple times. For e.g. Calculator +// application launch would cause around 20 registry updates in case we would +// always make changes to shared memory immediately after registry update. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::RegistryChanged( ) + { + if ( iIdle && !iIdle->IsActive() ) + { + iIdle->Start( TCallBack( IdleCallbackL, this ) ); + } + } + +// --------------------------------------------------------------------------- +// Callback for CIdle. +// +// We check the current enabled/disabled status of tactile feedback for +// this application, and either UpdateRegistryToChunkL for updating whole +// registry to shared chunk, or ClearWholeChunkL for clearing all feedback +// areas from the shared chunk. +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackClient::IdleCallbackL( TAny* aPtr ) + { + if ( aPtr ) + { + CTouchFeedbackClient* self = + static_cast ( aPtr ); + + if ( self->iFeedback.FeedbackEnabledForThisApp() ) + { + self->UpdateRegistryToChunkL(); + } + else + { + self->ClearWholeChunkL(); + } + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Area registry is written to shared memory in following format +// +// + Header (four bytes) = Number of windows as TInt +// + Window entries +// + Area registry entries +// +// Window entries: For each window: +// [four bytes] = Window handle +// [four bytes] = Number of registry entries in this window +// [four bytes] = Offset of registry data from beginning of chunk +// Area registry entries: +// - Each entry written as TFeedbackChunkAreaEntry straight into memory +// +// +// Steps taken in this function: +// +// #1 Calculate the size needed for area registry data +// #2 Mutual exclusion with global semaphore +// #3 Increase Chunk size in case necessary +// #4 Update Chunk contents. This is now done simply by writing the whole +// area registry into the shared memory. +// #5 Release semaphore +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::UpdateRegistryToChunkL() + { + TRACE( "CTouchFeedbackClient::UpdateRegistryToChunkL - Begin" ); + + RPointerArray* registry = + iFeedback.RegistryArray(); + + // Do cleanup so that empty registry instances are not hanging anymore + TInt windowIndex = 0; + TInt cleanupAreaCount = 0; + TInt cleanupWindowCount = 0; + // value is returned in parameter variable + iFeedback.GetAreaCount( cleanupAreaCount, cleanupWindowCount ); + + while ( windowIndex < cleanupWindowCount ) + { + TBool emptyWindow = ( (*registry)[windowIndex]->AreaCount() == 0 ); + if ( emptyWindow ) + { + // Remove empty/possibly destroyed registry instance that possibly + // may refer to destroyed control/window. + CTouchFeedbackRegistry* feedbackRegistry = (*registry)[windowIndex]; + registry->Remove( windowIndex ); + delete feedbackRegistry; + cleanupWindowCount--; + } + else + { + windowIndex++; // to next window + } + } + + // #1 Calculate the size needed + TInt windowCount(0); + TInt areaCount(0); + iFeedback.GetAreaCount( areaCount, windowCount ); + + // Header contains only number of windows in this registry + TInt headerSize = sizeof( TInt ); + + // There is a list of windows in this registry in the beginning, with + // data offsets in the chunk + TInt windowItemSize = + sizeof( TInt ) + // Window handle + sizeof( TInt ) + // Area count + sizeof( TInt ); // Offset to area registry entries + + // Size of one area registry entry + TInt areaItemSize = sizeof( TFeedbackChunkAreaEntry ); + + TInt sizeNeeded = + headerSize + + windowCount * windowItemSize + + areaCount * areaItemSize; + + // #2 Mutual exclusion + iSemaphore.Wait(); + + // We use cleanup item for making sure that semaphore will not stay + // reserved in case there is a leave. + CleanupStack::PushL( TCleanupItem( CleanupSemaphore, &iSemaphore ) ); + + // #3 Increase chunk (committed) size in case needed + if ( iChunk.Size() < sizeNeeded ) + { + TInt err = iChunk.Adjust( sizeNeeded ); + + if ( err != KErrNone ) + { + // In case the current registry does not fit to the chunk, then + // we'll set window count to zero, in case that is possible + // (it is not possible if chunk size is zero). + // This means that there won't be any area registry based + // feedback for this application on the moment. + if ( iChunk.Size() > 0 ) + { + TInt* chunkPtr = reinterpret_cast( iChunk.Base() ); + + // Set window count to zero + *chunkPtr = 0; + } + + // We will leave anyway + User::Leave( err ); + } + } + + + // #4 Update chunk contents + TInt* chunkPtr = reinterpret_cast( iChunk.Base() ); + + // Set window count in the beginning of chunk + *chunkPtr = windowCount; + chunkPtr++; + + TInt areaOffset = headerSize + windowCount * windowItemSize; + + // This is pointer to the first area registry entry in the chunk + TFeedbackChunkAreaEntry* chunkEntryPtr + = reinterpret_cast ( iChunk.Base() + areaOffset ); + + // Check if audio or vibra is disabled for this application. + TBool audioEnabled = iFeedback.FeedbackEnabledForThisApp( ETouchFeedbackAudio ); + TBool vibraEnabled = iFeedback.FeedbackEnabledForThisApp( ETouchFeedbackVibra ); + + // One loop round for each window where we have area registry entries. + for ( TInt windowIndex = 0; windowIndex < windowCount; windowIndex++ ) + { + RArray* windowRegistry = + (*registry)[windowIndex]->WindowRegistry(); + + // Write handle of this window + *chunkPtr = (*registry)[windowIndex]->WindowHandle(); + chunkPtr++; + // Store the address where we shall write count later + // (We don't know the amount of areas yet, as we shall + // only add areas of visible controls). + TInt* countPointer = chunkPtr; + chunkPtr++; + // Write offset of the area registry entries of this window + *chunkPtr = ((TInt)chunkEntryPtr-(TInt)iChunk.Base()); + chunkPtr++; + + // Write all areas of visible controls in this window + // to the shared memory. Invisible controls' areas are left out so + // that they won't mess up the feedback for overlapping visible + // controls. + TInt visibleAreaCount = 0; + for ( TInt areaIndex = windowRegistry->Count()-1; areaIndex >= 0; areaIndex-- ) + { + TFeedbackEntry entry = (*windowRegistry)[areaIndex]; + + if ( entry.iVisible ) + { + chunkEntryPtr->iRect = entry.iRect; + + TInt feedback = ( entry.iFeedbackTypeUp << 10 ); + feedback |= entry.iFeedbackTypeDown; + + // Add audio and vibra information to feedback type + if ( entry.iVibraEnabled && vibraEnabled ) + { + //feedback |= KTactileVibraBit; + if ( entry.iFeedbackDown & ETouchFeedbackVibra ) + { + feedback |= KTactileVibraBitDown; + } + if ( entry.iFeedbackUp & ETouchFeedbackVibra ) + { + feedback |= KTactileVibraBitUp; + } + + } + if ( entry.iAudioEnabled && audioEnabled ) + { + //feedback |= KTactileAudioBit; + if ( entry.iFeedbackDown & ETouchFeedbackAudio ) + { + feedback |= KTactileAudioBitDown; + } + if ( entry.iFeedbackUp & ETouchFeedbackAudio ) + { + feedback |= KTactileAudioBitUp; + } + } + + chunkEntryPtr->iFeedbackType = static_cast( feedback ); + + chunkEntryPtr->iEventType = entry.iEventType; + + chunkEntryPtr++; + visibleAreaCount++; + } + } + // Now store area count as we know the amount of visible areas + // for this window. + *countPointer = visibleAreaCount; + } + + // #5 Release semaphore so that other processes can access the chunks again + // This calls "Signal" on the semaphore + CleanupStack::PopAndDestroy(&iSemaphore); + + TRACE( "CTouchFeedbackClient::UpdateRegistryToChunkL - End" ); + } + +// --------------------------------------------------------------------------- +// Despite the function name, we don't actually clear whole chunk here +// as that is not necessary. It is enough to set the window count to zero +// at beginning of chunk, as then server will consider this chunk empty. +// +// #1 Mutual exclusion +// #2 Make sure chunk is not of zero -size +// #3 Set window count to zero at beginning of chunk +// #4 Release mutual exclusion +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::ClearWholeChunkL() + { + TRACE( "CTouchFeedbackClient::ClearWholeChunkL - Begin" ); + + // #1 Mutual exclusion + iSemaphore.Wait(); + + // We use cleanup item for making sure that semaphore will not stay + // reserved in case there is a leave. + CleanupStack::PushL( TCleanupItem( CleanupSemaphore, &iSemaphore ) ); + + // We only need four bytes for the data, as we are only going to store + // one number to the chunk. But we count the space just in case anyway, + // because at some point chunks initial size may be change so that it is + // zero. + TInt sizeNeeded = sizeof( TInt ); + + // #2 Increase chunk (committed) size in case needed + if ( iChunk.Size() < sizeNeeded ) + { + User::LeaveIfError( iChunk.Adjust( sizeNeeded ) ); + } + + // #3 Update chunk contents + TInt* chunkPtr = reinterpret_cast( iChunk.Base() ); + + // Set window count to zero (this is enough for the server to think + // that there are no feedback areas at all). + *chunkPtr = 0; + + // #4 Release semaphore + CleanupStack::PopAndDestroy(&iSemaphore); + + TRACE( "CTouchFeedbackClient::ClearWholeChunkL - End" ); + } + +// --------------------------------------------------------------------------- +// This is a cleanup function for releasing a semaphore in case there will +// be a leave after calling RSemaphore::Wait (otherwise there could easily +// be a deadlock in the system). +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::CleanupSemaphore( TAny* aPtr ) + { + TRACE( "CTouchFeedbackClient::CleanupSemaphore" ); + + if ( aPtr ) + { + RSemaphore* sem = static_cast ( aPtr ); + + sem->Signal(); + } + } + +// --------------------------------------------------------------------------- +// Here we just send the logical feedback type to server. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::ImmediateFeedback( TTouchLogicalFeedback aType, + TBool aVibraOn, TBool aAudioOn ) + { + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLIENT_INSTANT_FEEDBACK_1, "e_TACTILE_CLIENT_INSTANT_FEEDBACK 1"); + + if ( aVibraOn || aAudioOn ) + { + iFbClient.PlayFeedback( aType, aVibraOn, aAudioOn ); + } + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_CLIENT_INSTANT_FEEDBACK_0, "e_TACTILE_CLIENT_INSTANT_FEEDBACK 0"); + } + +// --------------------------------------------------------------------------- +// Check that we really have something to update, and then do the update. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackClient::FlushUpdates() + { + if ( iIdle && iIdle->IsActive() ) + { + // Do the updates + TRAP_IGNORE( IdleCallbackL( this ) ); + + // Cancel pending update request (no need to keep it active since + // registry is now up-to-date). + iIdle->Cancel(); + } + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CTouchFeedbackClient::StartFeedback( TUint32 aClientHandle, + TTouchContinuousFeedback aType, + TInt aIntensity, + TTimeIntervalMicroSeconds32 aTimeout ) + { + TRACE("CTouchFeedbackClient::StartFeedback - Begin"); + + if ( !iFeedbackTimer->IsActive() ) + { + iPreviousIntensity = aIntensity; + iFbClient.StartFeedback( aType, aIntensity ); + iClientHandle = aClientHandle; // Control, which started the feedback. + } + if ( aTimeout != TTimeIntervalMicroSeconds32(0) ) + { + StartFeedbackTimer( aTimeout ); + + if ( aIntensity != iPreviousIntensity ) + { + ModifyFeedback( aClientHandle, aIntensity ); + } + } + + TRACE("CTouchFeedbackClient::StartFeedback - End"); + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CTouchFeedbackClient::ModifyFeedback( TUint32 aClientHandle, + TInt aIntensity ) + { + // Modification is allowed only for the same control, which started + // the feedback. + if ( aClientHandle == iClientHandle && + aIntensity != iPreviousIntensity ) + { + iPreviousIntensity = aIntensity; + iFbClient.ModifyFeedback( aIntensity ); + } + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CTouchFeedbackClient::StopFeedback( const TUint32 aClientHandle ) + { + TRACE("CTouchFeedbackClient::StopFeedback - Begin"); + if ( aClientHandle == iClientHandle ) + { + iFbClient.StopFeedback(); + iFeedbackTimer->Cancel(); + // Clear also client handle to indicate there's no ongoing feedback. + iClientHandle = 0; + } + TRACE("CTouchFeedbackClient::StopFeedback - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackClient::SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ) + { + return iFbClient.SetFeedbackEnabledForDevice( aFeedbackType ); + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +TTouchFeedbackType CTouchFeedbackClient::FeedbackEnabledForDevice() + { + TTouchFeedbackType feedbackEnabled; + iFbClient.FeedbackEnabledForDevice( feedbackEnabled ); + return feedbackEnabled; + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CTouchFeedbackClient::StartFeedbackTimer( TTimeIntervalMicroSeconds32 aTimeout ) + { + iFeedbackTimer->Cancel(); + TCallBack callback( StopFeedbackCallback, this ); + iFeedbackTimer->Start( aTimeout, 0, callback ); + } + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +// +void CTouchFeedbackClient::StopFeedbackByTimeout() + { + iFeedbackTimer->Cancel(); + iFbClient.StopFeedback(); + iClientHandle = 0; + } + +// ---------------------------------------------------------------------------- +// CAknSlider::StopFeedbackCallback +// ---------------------------------------------------------------------------- +// +TInt CTouchFeedbackClient::StopFeedbackCallback( TAny* aThis ) + { + TRACE("CTouchFeedbackClient::StopFeedbackCallback - Begin"); + static_cast( aThis )->StopFeedbackByTimeout(); + TRACE("CTouchFeedbackClient::StopFeedbackCallback - End"); + return KErrNone; + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedbackclientpanic.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackclientpanic.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Panic function for Tactile Feedback Client +* Part of: Tactile Feedback. +* +*/ + + + +#include + +#include "touchfeedbackclientpanic.h" + + +_LIT( KTouchClientPanic, "Touch FB Client" ); + + +void Panic( TTouchFeedbackClientPanic aPanic ) + { + User::Panic( KTouchClientPanic, aPanic ); + } + +// End of File + + + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,1774 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the actual Client API implementation. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "touchfeedbackimpl.h" +#include "touchfeedbackclient.h" +#include "touchfeedbackregistry.h" +#include "touchfeedbackclientpanic.h" + +/** + * This is the maximum number that can be used as feedback area identifier. + * after this the values starting from 1 are taken into use again when + * new areas are added. This also defines the maximum number of feedback + * areas that one application can have. + */ +const TInt KTouchMaxFeedbackAreaIdentifier = 5000; + + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Cleanup items for removing latest item from the given array. These are used +// for cleanup in case something leaves when we are adding new area +// to the registry. +// --------------------------------------------------------------------------- +// +void CleanupCacheArray( TAny* aPtr ) + { + RArray* array = + static_cast*> ( aPtr ); + + TInt index = array->Count() - 1; + + // If we are removing control from cache, then we have to clean the + // associated area array also, or otherwise there will be a memory leak. + (*array)[index].iAreaArray.Reset(); + (*array)[index].iAreaArray.Close(); + + array->Remove( array->Count()-1 ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CleanupAreaArray( TAny* aPtr ) + { + RArray* array = + static_cast*> ( aPtr ); + + array->Remove( array->Count()-1 ); + } + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackImpl::CTouchFeedbackImpl() : + iAudioEnabledForThisApp( ETrue ), + iVibraEnabledForThisApp( ETrue ) + { + } + +// --------------------------------------------------------------------------- +// We check first if Tactile Feedback feature is supported in this device +// and only construct the iClient -member in case needed. We thus use +// the existence of iClient as feature check in other API functions. +// +// This also means that iClient member needs to be checked in all the API +// functions, so that we won't cause a KERN-EXEC 3 by trying to access +// a NULL pointer in case the feature is disabled. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::ConstructL() + { + TRACE("CTouchFeedbackImpl::ConstructL - Begin"); + + // Check if the whole Tactile Feedback feature is supported or not + + // Initialize feature manager, just in case we happen to be the first + // one using it in this thread. + FeatureManager::InitializeLibL(); + + TBool featureSupported = + FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); + + // We don't need feature manager anymore, as it is not possible + // to change this feature on/off at run-time + FeatureManager::UnInitializeLib(); + + // Only create client in case feature is supported + if ( featureSupported ) + { + iClient = CTouchFeedbackClient::NewL( *this ); + } + else + { + TRACE("Tactile Feedback feature is not supported"); + } + + // Check if pen usage is enabled. We use this information later for + // disabling area registry -based feedback in case pen usage is not + // enabled. + iPenEnabled = AknLayoutUtils::PenEnabled(); + + TRACE3("CTouchFeedbackImpl::ConstructL - End, feature supported = %d, pen Enabled: %d", featureSupported, iPenEnabled); + } + +// --------------------------------------------------------------------------- +// We cannot afford to leave here (at least for the moment), because +// in that case the whole system won't boot up. Constructing of the +// client (in ConstructL) will fail if click plugin is not configured in +// WSINI.INI file, and that can happen very easily at least in the beginning +// when this is a new feature. Thus we TRAP any leaves here. +// +// This also means that iClient member needs to be checked in all the API +// functions. We will also use this for recognizing the situation when +// touch feedback is not supported (in that case we won't even try to +// instantiate the client). +// --------------------------------------------------------------------------- +// +CTouchFeedbackImpl* CTouchFeedbackImpl::New() + { + CTouchFeedbackImpl* self = new CTouchFeedbackImpl; + if ( self ) + { + TRAP_IGNORE( self->ConstructL() ); + } + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackImpl::~CTouchFeedbackImpl() + { + TRACE("CTouchFeedbackImpl::~CTouchFeedbackImpl"); + + delete iClient; + + TInt i = 0; + + for ( i=0; i < iRegistryArray.Count(); i++ ) + { + delete iRegistryArray[i]; + } + + for ( i=iControlCache.Count()-1; i >= 0; i-- ) + { + RemoveControlFromCache( i ); + } + + iRegistryArray.Close(); + iControlCache.Close(); + } + +// --------------------------------------------------------------------------- +// We return ETrue if iClient exist, because instantiation of the client is +// not done in case the feature is not enabled. And on the other hand if +// instantiation of client fails, then using of feedback is not possible +// anyway. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::TouchFeedbackSupported() + { + if ( iClient ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------------------------- +// Store the current status of feedback for this application, and +// notify server of the change. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::SetFeedbackEnabledForThisApp( TBool aEnabled ) + { + TRACE2( "CTouchFeedbackImpl::SetFeedbackEnabledForThisApp %d", aEnabled ); + + // Only notify server when enabled value really changes. + if ( iClient && + (( aEnabled != iAudioEnabledForThisApp ) || + (aEnabled != iVibraEnabledForThisApp ) )) + { + iClient->RegistryChanged(); + } + + iAudioEnabledForThisApp = aEnabled; + iVibraEnabledForThisApp = aEnabled; + } + +// --------------------------------------------------------------------------- +// Here we just return the current status. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::FeedbackEnabledForThisApp() + { + return iAudioEnabledForThisApp || iVibraEnabledForThisApp; + } + +// --------------------------------------------------------------------------- +// This functions main purpose is to do all possible parameter checks to +// the arguments before actually setting the area. +// +// #1 Check that feedback is enabled +// #2 Check that we weren't given a NULL pointer as control. +// #3 Check that feedback type and pointer event are supported +// #4 Check that we can generate a client handle from the control +// (if not, then there is something wrong with given control) +// #5 Call overridden method SetFeedbackArea for actually setting the +// feedback area. +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackImpl::SetFeedbackArea( + const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + TTouchLogicalFeedback aFeedbackType, + TTouchEventType aEventType ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea - Begin"); + + // #1 + if ( !iClient ) + { + return KErrNone; + } + + // #2 + if ( !aControl ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea - Err: NULL Control"); + return KErrArgument; + } + + // #3 + if ( aFeedbackType > ETouchFeedbackSensitive || + ( aEventType!= ETouchEventStylusDown ) ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea - Err: Unsupported params"); + return KErrNotSupported; + } + + // #4 + TUint32 clientHandle = ClientHandle( aControl ); + + if ( !clientHandle ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea - Err: Invalid Control"); + return KErrArgument; + } + + // #5 + TInt err(KErrGeneral); + CFeedbackSpec* spec = CFeedbackSpec::New(); + if (spec) + { + spec->AddFeedback(aEventType, aFeedbackType); + err = SetFeedbackArea(aControl, aIndex, aRect, spec); + delete spec; + spec = NULL; + } + + TRACE2("CTouchFeedbackImpl::SetFeedbackArea - End, err = %d", err ); + return err; + } + +// --------------------------------------------------------------------------- +// Here we remove the given area from registry. +// +// We still keep the control in the registry even if would have no areas, +// because otherwise we'll lose feedback disabled/enabled information. +// +// #1 First check that given area is actually found +// #2 Find corresponsing registry entry +// #3 Remove feedback area entry from control cache +// #4 Finally remove the actual area from registry, and notify server +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::RemoveFeedbackArea( + const CCoeControl* aControl, + TUint32 aIndex ) + { + TRACE3( "CTouchFeedbackImpl::RemoveFeedbackArea: 0x%x, %d", aControl, aIndex ); + + if ( iClient ) + { + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + // #1 Only do something in case the area was found + if ( cacheIndex >=0 && areaIndex >= 0 ) + { + // #2 + TInt registryIndex = FindWindowFromRegistry ( + iControlCache[cacheIndex].iClientHandle ); + + TInt areaId = + iControlCache[cacheIndex].iAreaArray[areaIndex].iAreaId; + + // #3 Remove this feedback area entry + iControlCache[cacheIndex].iAreaArray.Remove( areaIndex ); + + iNbOfFeedbackAreas--; + + // #4 Remove the area from registry + if ( registryIndex != KErrNotFound ) + { + iRegistryArray[registryIndex]->RemoveFeedbackArea( areaId ); + + iClient->RegistryChanged(); + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we return all areas related to given control. +// +// #1 Only do something in case the control is found from cache +// #2 Find corresponding registry index. +// #3 Remove all feedback areas from the registry. +// #4 Remove the control from cache +// #5 Notify server, if some areas were really removed. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::RemoveFeedbackForControl( + const CCoeControl* aControl ) + { + TRACE2("CTouchFeedbackImpl::RemoveFeedbackForControl: 0x%x", aControl); + + if ( iClient ) + { + TInt controlIndex = FindControlFromCache( aControl ); + + // #1 + if ( controlIndex >= 0 ) // If control was found + { + TBool changesMade = EFalse; + + TControlCacheEntry& entry( iControlCache[controlIndex] ); + + // #2 + TInt registryIndex = + FindWindowFromRegistry( entry.iClientHandle ); + + // #3 If registry entry was found, then remove all feedback + // areas. + if ( registryIndex >= 0) + { + for ( TInt i=0; i < entry.iAreaArray.Count(); i++ ) + { + iRegistryArray[registryIndex]-> + RemoveFeedbackArea( + entry.iAreaArray[i].iAreaId ); + + changesMade = ETrue; + + iNbOfFeedbackAreas--; + } + } + + // #4 Anyway remove controls feedback areas from cache + RemoveControlFromCache( controlIndex ); + + // #5 Notify server of changes + if ( changesMade ) + { + iClient->RegistryChanged(); + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we change the rectangle of existing feedback area. +// +// #1 Only do something in case the area is really found. +// #2 Find corresponding registry entry +// #3 If the entry was found, then change the feedback area +// #4 Only notify the server when the area really changed +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::ChangeFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aNewRect ) + { + TRACE( "CTouchFeedbackImpl::ChangeFeedbackArea: 0x%x" ); + + if ( iClient ) + { + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + // #1 + if ( cacheIndex >= 0 && areaIndex >= 0 ) + { + TInt id = + iControlCache[cacheIndex].iAreaArray[areaIndex].iAreaId; + + // #2 + TInt registryIndex = + FindWindowFromRegistry ( + iControlCache[cacheIndex].iClientHandle ); + + // #3 + if ( registryIndex != KErrNotFound ) + { + TBool changed = + iRegistryArray[registryIndex]->ChangeFeedbackArea( + id, + aNewRect ); + + // #4 Only send upates to server when something + // really changed. + if ( changed ) + { + iClient->RegistryChanged(); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we change the feedback type of existing feedback area. +// +// #1 Only do something in case the area is really found. +// #2 Find corresponding registry entry +// #3 If the entry was found, then change the feedback area +// #4 Only notify the server when the feedback type really changed +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::ChangeFeedbackType( const CCoeControl* aControl, + TUint32 aIndex, + TTouchLogicalFeedback aNewType ) + { + TRACE4("CTouchFeedbackImpl::ChangeFeedbackType: 0x%x, %d, %d", aControl, aIndex, aNewType); + + if ( iClient ) + { + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + // #1 + if ( cacheIndex >= 0 && areaIndex >= 0 ) + { + TInt id = iControlCache[cacheIndex].iAreaArray[areaIndex].iAreaId; + + // #2 + TInt registryIndex = + FindWindowFromRegistry ( + iControlCache[cacheIndex].iClientHandle ); + + // #3 + if ( registryIndex != KErrNotFound ) + { + TBool changed = + iRegistryArray[registryIndex]->ChangeFeedbackType( + id, + aNewType, + // Feedback type change for up event is not supported + // by this function. + static_cast( 0xFFFFFFFF ) ); + + // #4 Only send upates to server when something + // really changed. + if ( changed ) + { + iClient->RegistryChanged(); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we change move the given feedback area to first priority, so that +// it will be the topmost in its window. +// +// #1 Only do something in case the area is really found. +// #2 Find corresponding registry entry +// #3 If the entry was found, then change the feedback area +// #4 Only notify the server when the move was successfull +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::MoveFeedbackAreaToFirstPriority( + const CCoeControl* aControl, + TUint32 aIndex ) + { + if ( iClient ) + { + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + // #1 + if ( cacheIndex >= 0 && areaIndex >= 0 ) + { + TInt id = iControlCache[cacheIndex].iAreaArray[areaIndex].iAreaId; + + // #2 + TInt registryIndex = + FindWindowFromRegistry ( + iControlCache[cacheIndex].iClientHandle ); + + // #3 + if ( registryIndex != KErrNotFound ) + { + TInt err = + iRegistryArray[registryIndex]-> + MoveFeedbackAreaToFirstPriority( id ); + + // #4 + if ( err == KErrNone ) + { + TRACE3("CTouchFeedbackImpl::MoveFeedbackAreaToFirstPriority 0x%x, %d", aControl, aIndex); + iClient->RegistryChanged(); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// Pass request to server in case feedback is enabled for this +// application. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::InstantFeedback( TTouchLogicalFeedback aType ) + { + if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) ) + { + TRACE2("CTouchFeedbackImpl::InstantFeedback %d", aType); + iClient->ImmediateFeedback( + aType, + iVibraEnabledForThisApp, + iAudioEnabledForThisApp ); + } + } + +// --------------------------------------------------------------------------- +// In this overload we only play direct feedback if the feedback has +// not been disabled for this control. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::InstantFeedback( + const CCoeControl* aControl, + TTouchLogicalFeedback aType ) + { + if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) ) + { + + // First take application level vibra and audio enablers + // as default + TBool vibraEnabled = iVibraEnabledForThisApp; + TBool audioEnabled = iAudioEnabledForThisApp; + + TInt cacheIndex = FindControlFromCache( aControl ); + + + // Check control level disablers for vibra and audio. + // (These can only prevent vibra or audio effect playback, + // but not to force it on) + if ( cacheIndex >=0 && vibraEnabled ) + { + vibraEnabled = !iControlCache[cacheIndex].iVibraDisabled; + } + + if ( cacheIndex >=0 && audioEnabled ) + { + audioEnabled = !iControlCache[cacheIndex].iAudioDisabled; + } + + TRACE3("CTouchFeedbackImpl::InstantFeedback 0x%x, %d", aControl, aType); + iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled ); + } + } + +// --------------------------------------------------------------------------- +// It is not enough to check that the control exists in the cache, we +// also need to check that it actually has some areas registered. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::ControlHasFeedback( const CCoeControl* aControl ) + { + TBool hasFeedback = EFalse; + + if ( iClient ) + { + for ( TInt i=0; i < iControlCache.Count(); i++ ) + { + if ( iControlCache[i].iControl == aControl ) + { + if ( iControlCache[i].iAreaArray.Count() > 0 ) + { + hasFeedback = ETrue; + } + + // Break out from loop anyway, since we found the + // control + break; + } + } + } + + return hasFeedback; + } + +// --------------------------------------------------------------------------- +// Control has feedback if it has a feedback identifier with given index +// number. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::ControlHasFeedback( + const CCoeControl* aControl, + TUint32 aIndex ) + { + TBool hasArea = EFalse; + + if ( iClient ) + { + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + if ( cacheIndex >= 0 && areaIndex >= 0 ) + { + hasArea = ETrue; + } + } + + return hasArea; + } + +// --------------------------------------------------------------------------- +// This overload is only wrapper to the real function +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::EnableFeedbackForControl( + const CCoeControl* aControl, + TBool aEnable ) + { + EnableFeedbackForControl( aControl, aEnable, aEnable ); + } + +// --------------------------------------------------------------------------- +// #1 Find control from the cache +// #2 In case control was found, disable/enable it's registry entries, and +// also take into accound it's dimming status +// #3 If control was not found, then add it to cache +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::EnableFeedbackForControl( + const CCoeControl* aControl, + TBool aEnableVibra, + TBool aEnableAudio ) + { + TRACE4( "CTouchFeedbackImpl::EnableFeedbackForControl - 0x%x Vibra:%d Audio:=%d", + aControl, aEnableVibra, aEnableAudio ); + + if ( aControl ) + { + // #1 + TInt cacheIndex = FindControlFromCache( aControl ); + + if ( cacheIndex >= 0 ) + { + // #2 + TControlCacheEntry& entry ( iControlCache[cacheIndex] ); + + entry.iVibraDisabled = !aEnableVibra; + entry.iAudioDisabled = !aEnableAudio; + + // Let's update visibility and dimming information also now + // that we have the pointer to control (due to broken object + // provider chain we might not have the correct information on + // the moment). + entry.iDimmed = aControl->IsDimmed(); + entry.iVisible = aControl->IsVisible(); + + if ( ControlsAreasActive( cacheIndex ) ) + { + // If control is active (undimmed and visible), then we + // set the areas according to parameters. + DoEnableControlsAreasInRegistry( cacheIndex, + aEnableVibra, + aEnableAudio, + aControl->IsVisible() ); + } + else + { + // If control is not active, then we disable all feedback. + DoEnableControlsAreasInRegistry( cacheIndex, + EFalse, + EFalse, + aControl->IsVisible() ); + } + } + else if ( !aEnableVibra || !aEnableAudio ) + { + // #3 We have to add control to the cache in case + // it is not there yet (and disabling is wanted), because + // otherwise it will be impossible to block feedback + TUint32 clientHandle = ClientHandle( aControl ); + + // We need to rely elsewhere that client handle exist if control + // is found in the cache --> Only make new entry if client + // handle can be aquired. + if ( clientHandle > 0 ) + { + TControlCacheEntry newCacheEntry; + + newCacheEntry.iControl = aControl; + newCacheEntry.iClientHandle = clientHandle; + newCacheEntry.iVibraDisabled = !aEnableVibra; + newCacheEntry.iAudioDisabled = !aEnableAudio; + newCacheEntry.iVisible = aControl->IsVisible(); + newCacheEntry.iDimmed = aControl->IsDimmed(); + + iControlCache.Append( newCacheEntry ); + } + } + } + } + +// --------------------------------------------------------------------------- +// Store the current status of audio and vibra feedbacks for this +// application, and notify server of the change. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::SetFeedbackEnabledForThisApp( + TBool aVibraEnabled, + TBool aAudioEnabled ) + { + TRACE3( "CTouchFeedbackImpl::SetFeedbackEnabledForThisApp %d %d", aVibraEnabled, aAudioEnabled ); + + // Only notify server when enabled value really changes. + if ( iClient && + (( aAudioEnabled != iAudioEnabledForThisApp ) || + (aVibraEnabled != iVibraEnabledForThisApp ) )) + { + iClient->RegistryChanged(); + } + + iAudioEnabledForThisApp = aAudioEnabled; + iVibraEnabledForThisApp = aVibraEnabled; + } + +// --------------------------------------------------------------------------- +// Simple utility for CTouchFeedbackClient +// --------------------------------------------------------------------------- +// +RPointerArray* CTouchFeedbackImpl::RegistryArray() + { + return &iRegistryArray; + } + +// --------------------------------------------------------------------------- +// Simple utility for CTouchFeedbackClient +// +// We return zero in case pen is not supported in current layout. This way +// area registry is disabled in non-touch powered layouts, but feedback areas +// are still kept in memory so that feedback can be enabled again in case +// layout changes. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::GetAreaCount( TInt& aAreaCount, TInt& aWindowCount ) + { + aWindowCount = 0; + aAreaCount = 0; + + if ( iPenEnabled ) + { + aWindowCount = iRegistryArray.Count(); + aAreaCount = iNbOfFeedbackAreas; + } + } + +// --------------------------------------------------------------------------- +// This function is called by the application framework when any control's +// visibility or dimming status has changed. +// +// We need to determine here whether the given control has any feedback, +// and whether its current state requires a change in feedback +// areas (for e.g. feedback areas will be disabled for any dimmed control). +// +// #1 Find control from cache (we don't need to do anything in case it +// is not found. +// #2 Check if control's feedback areas are now active (based on dimming, +// visibility and feedback disabling). Also check control's current +// visibility status as itself, as this determines whether the area will +// be put to registry at all. +// #3 Save control's current dimming and visibility status +// #4 Check again if control's areas should be active +// #5 Disable/Enable areas in case needed +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::ControlVisibilityChanged( + const CCoeControl* aControl ) + { + if ( iClient && aControl ) + { + // #1 + TInt cacheIndex = FindControlFromCache( aControl ); + + if ( cacheIndex >= 0 ) + { + // #2 + TBool oldStatus = ControlsAreasActive( cacheIndex ); + TBool oldVisible = iControlCache[cacheIndex].iVisible; + + // #3 + iControlCache[cacheIndex].iVisible = aControl->IsVisible(); + iControlCache[cacheIndex].iDimmed = aControl->IsDimmed(); + + + // #4 + TBool newStatus = ControlsAreasActive( cacheIndex ); + + // #5 + if ( ( oldStatus != newStatus ) || + ( oldVisible != aControl->IsVisible() ) ) + { + if ( newStatus ) // If control is now active + { + DoEnableControlsAreasInRegistry( + cacheIndex, + !iControlCache[cacheIndex].iVibraDisabled, + !iControlCache[cacheIndex].iAudioDisabled, + aControl->IsVisible() ); + } + else + { + DoEnableControlsAreasInRegistry( cacheIndex, + EFalse, + EFalse, + aControl->IsVisible() ); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we check whether the pen support status has changed, and update +// registry in case needed. +// +// Notice that this has not effect on direct feedback: It is completely on +// UI control's responsibility to check if pen is supported with direct +// feedback (direct feedback is not automatically disabled because that +// would cause problems in compatibility mode). +// +// Also notice that we don't actually destroy any feedback areas when pen +// usage is not supported: We just report zero areas to server side, but +// still keep everything in memory (see GetAreaCount -function) +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::LayoutChanged() + { + if ( iClient ) + { + TBool penEnabledNow = AknLayoutUtils::PenEnabled(); + + TRACE2("CTouchFeedbackImpl::LayoutChanged, PenEnabled = %d", penEnabledNow); + + if ( penEnabledNow != iPenEnabled ) + { + iPenEnabled = penEnabledNow; + + iClient->RegistryChanged(); + } + } + } + +// new functions from MTouchFeedback that came in 5.2 +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::FeedbackEnabledForThisApp( TTouchFeedbackType aFeedbackType ) + { + TBool feedbackEnabled( ETrue ); + + if ( (aFeedbackType & ETouchFeedbackAudio) && !iAudioEnabledForThisApp ) + { + feedbackEnabled = EFalse; + } + + if ( (aFeedbackType & ETouchFeedbackVibra) && !iVibraEnabledForThisApp ) + { + feedbackEnabled = EFalse; + } + + if ( !aFeedbackType ) + { + feedbackEnabled = EFalse; + } + + return feedbackEnabled; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::StartFeedback( const CCoeControl* aControl, + TTouchContinuousFeedback aType, + const TPointerEvent* /*aPointerEvent*/, + TInt aIntensity, + TTimeIntervalMicroSeconds32 aTimeout ) + { + if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) ) + { + // First take application level vibra and audio enablers + // as default + TBool vibraEnabled = iVibraEnabledForThisApp; + TBool audioEnabled = iAudioEnabledForThisApp; + + TInt cacheIndex = FindControlFromCache( aControl ); + + + // Check control level disablers for vibra and audio. + // (These can only prevent vibra or audio effect playback, + // but not to force it on) + if ( cacheIndex >=0 && vibraEnabled ) + { + vibraEnabled = !iControlCache[cacheIndex].iVibraDisabled; + } + + if ( cacheIndex >=0 && audioEnabled ) + { + audioEnabled = !iControlCache[cacheIndex].iAudioDisabled; + } + + if ( vibraEnabled || audioEnabled ) + { + TRACE4("CTouchFeedbackImpl::StartFeedback, type:=%d intensity:%d, timeout:%d", aType, aIntensity, aTimeout); + TUint32 clientHandle = ClientHandle( aControl ); + iClient->StartFeedback( clientHandle, + aType, + aIntensity, + aTimeout ); + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::ModifyFeedback( const CCoeControl* aControl, + TInt aIntensity ) + { + if ( iClient ) + { + TRACE2("CTouchFeedbackImpl::ModifyFeedbac, intensity:%d, timeout:%d", aIntensity); + TUint32 clientHandle = ClientHandle( aControl ); + iClient->ModifyFeedback( clientHandle, aIntensity ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::StopFeedback( const CCoeControl* aControl ) + { + if ( iClient ) + { + TUint32 clientHandle = ClientHandle( aControl ); + iClient->StopFeedback( clientHandle ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackImpl::SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ) + { + TInt ret( KErrGeneral ); + if ( iClient ) + { + ret = iClient->SetFeedbackEnabledForDevice( aFeedbackType ); + } + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TTouchFeedbackType CTouchFeedbackImpl::FeedbackEnabledForDevice() + { + TTouchFeedbackType enabled( static_cast(0) ); + if ( iClient ) + { + enabled = iClient->FeedbackEnabledForDevice(); + } + return enabled; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + const TPointerEvent& /*aPointerEvent*/ ) + { + InstantFeedback(aControl, aType); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackImpl::SetFeedbackArea( const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + CFeedbackSpec* aFeedbackSpec ) + { + // #1 + if ( !iClient ) + { + return KErrNone; + } + + // #2 + if ( !aControl ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea(spec) - Err: NULL Control"); + return KErrArgument; + } + + // #4 + TUint32 clientHandle = ClientHandle( aControl ); + + if ( !clientHandle ) + { + TRACE("CTouchFeedbackImpl::SetFeedbackArea(spec) - Err: Invalid Control"); + return KErrArgument; + } + + // #5 + TRAPD( err, + DoSetFeedbackAreaL( + aControl, + aIndex, + aRect, + aFeedbackSpec, + clientHandle ) ); + + if (err) + { + TRACE2("CTouchFeedbackImpl::SetFeedbackArea(spec) err = %d", err ); + } + + return err; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::InstantFeedback( const CCoeControl* aControl, + TTouchLogicalFeedback aType, + TTouchFeedbackType aFeedbackType, + const TPointerEvent& /*aPointerEvent*/ ) + { + if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) ) + { + // Initialize vibra and audio enablers as given in param. + TBool vibraEnabled = aFeedbackType & ETouchFeedbackVibra; + TBool audioEnabled = aFeedbackType & ETouchFeedbackAudio; + + // Check application level vibra and audio enablers + if ( !iVibraEnabledForThisApp ) + { + vibraEnabled = EFalse; + } + if ( !iAudioEnabledForThisApp ) + { + audioEnabled = EFalse; + } + + TInt cacheIndex = FindControlFromCache( aControl ); + + + // Check control level disablers for vibra and audio. + // (These can only prevent vibra or audio effect playback, + // but not to force it on) + if ( cacheIndex >=0 && vibraEnabled ) + { + vibraEnabled = !iControlCache[cacheIndex].iVibraDisabled; + } + + if ( cacheIndex >=0 && audioEnabled ) + { + audioEnabled = !iControlCache[cacheIndex].iAudioDisabled; + } + + TRACE5("CTouchFeedbackImpl::InstantFeedback, 0x%x, type:=%d Vibra:%d Audio:%d", + aControl, aType, vibraEnabled, audioEnabled); + iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled ); + } + } + +// --------------------------------------------------------------------------- +// Here we do the actual work for adding new area to the registry +// (or updating an existing one). +// +// #1 Check that control exist in the cache +// #2a If it does not exist, then add it +// #2b If control exists, but area not, then add new area +// #2c If control and area both exist, then use existing id +// #3 Find corresponding registry entry +// #4 Create new entry if this was the first area for this window +// #5 Determine if new area should actually be active, and then +// add it to registry +// #6 Inform server if we added an active area +// +// We use specific cleanup items for removing the added area and/or control +// from the control cache in caes adding of the area to the actual +// registry fails. This way actual registry and control cache will remain +// in sync no matter what happens. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::DoSetFeedbackAreaL( + const CCoeControl* aControl, + TUint32 aIndex, + TRect aRect, + CFeedbackSpec* aFeedbackSpec, + TUint32 aClientHandle ) + { + TInt id = KErrNotFound; + TInt nbOfCleanupItems = 0; + TBool newArea = EFalse; + + // #1 + TInt cacheIndex = KErrNotFound; + TInt areaIndex = KErrNotFound; + FindAreaFromCache( aControl, aIndex, cacheIndex, areaIndex ); + + // #2a + if ( cacheIndex < 0 ) + { + id = GenerateUniqueIdL(); + + TControlCacheEntry newCacheEntry; + + newCacheEntry.iControl = aControl; + newCacheEntry.iClientHandle = aClientHandle; + newCacheEntry.iVibraDisabled = EFalse; + newCacheEntry.iAudioDisabled = EFalse; + newCacheEntry.iVisible = aControl->IsVisible(); + newCacheEntry.iDimmed = aControl->IsDimmed(); + + // New entry will be added at the end of array + // This assignment will also make it possible to use + // "cacheIndex" -variable in the rest of the function + // in all cases. + cacheIndex = iControlCache.Count(); + + iControlCache.AppendL( newCacheEntry ); + + // Use cleanup item to remove the control in case something + // fails later in this function. + CleanupStack::PushL( + TCleanupItem( CleanupCacheArray, &iControlCache ) ); + nbOfCleanupItems++; + + TAreaIndexEntry newAreaEntry; + + newAreaEntry.iIndex = aIndex; + newAreaEntry.iAreaId = id; + + iControlCache[cacheIndex].iAreaArray.AppendL( newAreaEntry ); + + // Use cleanup item to remove the area id in case something + // fails later in this function. + CleanupStack::PushL( + TCleanupItem( CleanupAreaArray, + &iControlCache[cacheIndex].iAreaArray) ); + nbOfCleanupItems++; + + newArea = ETrue; + + // Enable control state change reports on the new control + CCoeControl* tmp = const_cast( aControl ); + tmp->EnableReportControlStateChange( ETrue ); + } + // #2b + else if ( areaIndex < 0 ) + { + id = GenerateUniqueIdL(); + + TAreaIndexEntry newAreaEntry; + + newAreaEntry.iIndex = aIndex; + newAreaEntry.iAreaId = id; + + iControlCache[cacheIndex].iAreaArray.AppendL( newAreaEntry ); + + CleanupStack::PushL( + TCleanupItem( CleanupAreaArray, + &iControlCache[cacheIndex].iAreaArray) ); + nbOfCleanupItems++; + + newArea = ETrue; + } + // #2c + else + { + id = iControlCache[cacheIndex].iAreaArray[areaIndex].iAreaId; + } + + // #3 + TInt registryIndex = FindWindowFromRegistry ( aClientHandle ); + + // #4 + if ( registryIndex == KErrNotFound ) + { + // There isn't yet a registry entry for this window + // --> Create it + CTouchFeedbackRegistry* newRegistry = + CTouchFeedbackRegistry::NewL( aClientHandle ); + + CleanupStack::PushL( newRegistry ); + + registryIndex = iRegistryArray.Count(); + + iRegistryArray.AppendL( newRegistry ); + + CleanupStack::Pop( newRegistry ); + } + + // #5 Determine what is the vibra and audio status for the new area + // (if control is invisible or dimmed then both will be disabled) + TBool vibraEnabled = EFalse; + TBool audioEnabled = EFalse; + + TBool areaActive = ControlsAreasActive( cacheIndex ); + + if ( areaActive ) + { + vibraEnabled = !iControlCache[cacheIndex].iVibraDisabled; + audioEnabled = !iControlCache[cacheIndex].iAudioDisabled; + } + + + RArray feedbackEntries; + CleanupClosePushL( feedbackEntries ); + TTouchEventType eventType(ETouchEventStylusDown); + TTouchLogicalFeedback feedbackTypeDown = ETouchFeedbackNone; + TTouchLogicalFeedback feedbackTypeUp = ETouchFeedbackNone; + TTouchFeedbackType feedbackDown = ETouchFeedbackVibra; + TTouchFeedbackType feedbackUp = ETouchFeedbackVibra; + aFeedbackSpec->GetFeedbackSpec(feedbackEntries); + TInt feedbackItems = feedbackEntries.Count(); + for (TInt i=0;i 0 ) + { + iRegistryArray[registryIndex]->AddFeedbackAreaL( + aRect, feedbackTypeDown, feedbackDown, feedbackTypeUp, feedbackUp, + eventType, id, vibraEnabled, audioEnabled, aControl->IsVisible() ); + } + CleanupStack::PopAndDestroy( &feedbackEntries ); + + // We can now remove the cleanup items, because nothing can fail + // anymore. + CleanupStack::Pop( nbOfCleanupItems ); + + // We can also update the counter now, when we know that the area + // was actually added + if ( newArea ) + { + iNbOfFeedbackAreas++; + } + + // #6 We only need to inform server in case we added an active area + // to the registry. + if ( areaActive ) + { + iClient->RegistryChanged(); + } + } + +// --------------------------------------------------------------------------- +// A simple for -loop should be enough here, as we are not likely to have +// that many windows in one application process. +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackImpl::FindWindowFromRegistry( TUint aWindowHandle ) + { + TInt index = KErrNotFound; + + for ( TInt i=0; i < iRegistryArray.Count(); i++ ) + { + if ( iRegistryArray[i]->WindowHandle() == aWindowHandle ) + { + index = i; + break; + } + } + + return index; + } + +// --------------------------------------------------------------------------- +// Just ask client to do updates immediately +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::FlushRegistryUpdates( ) + { + if ( iClient ) + { + TRACE("CTouchFeedbackImpl::FlushRegistryUpdates" ); + iClient->FlushUpdates(); + } + } + +// --------------------------------------------------------------------------- +// We use integer numers starting from 1 as area identifiers. +// +// There is a bookkeeping of last used identifier, and we'll start from one +// again after reaching the maximum value. +// +// There is also a separate bookkeeping to know if our id values have been +// rotated at least once or not. From that we know if we have to check that +// the id is not in use already (if we are on the first round, then there +// cannot be any area with the new id). +// +// Notice that it should be checked already _before_ calling this function, +// whether it is actually possible to find an unused identifier anymore. +// --------------------------------------------------------------------------- +// +TUint CTouchFeedbackImpl::GenerateUniqueIdL() + { + // First check that there actually is an identifier that we can find + // (i.e. check that maximum number of areas has not been reached) + if ( iNbOfFeedbackAreas >= KTouchMaxFeedbackAreaIdentifier ) + { + User::Leave( KErrNoMemory ); + } + + iCurrentId++; + + if ( iCurrentId > KTouchMaxFeedbackAreaIdentifier ) + { + iCurrentId = 1; + + iCurrentIdCounterRotated = ETrue; + } + + if ( iCurrentIdCounterRotated ) + { + while ( FeedbackAreaExists( iCurrentId ) ) + { + iCurrentId++; + + if ( iCurrentId > KTouchMaxFeedbackAreaIdentifier ) + { + iCurrentId = 1; + } + } + + } + + return iCurrentId; + } + +// --------------------------------------------------------------------------- +// Scan through local registry in order to know whether the area with +// given identifier exists. +// +// This function is only used when creating a new unique identifier. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::FeedbackAreaExists( TUint aAreaId ) + { + TBool areaExists = EFalse; + + for ( TInt i=0; i < iRegistryArray.Count() && !areaExists; i++ ) + { + RArray* entryArray = + iRegistryArray[i]->WindowRegistry(); + + for ( TInt j=0; j < entryArray->Count() && !areaExists; j++ ) + { + if ( (*entryArray)[j].iId == aAreaId ) + { + areaExists = ETrue; + } + } + } + + return areaExists; + } + +// --------------------------------------------------------------------------- +// Because we use the so called "client handle" for identifying windows on +// client- and server sides, we must be able to generate a client handle +// from CCoeControl -pointer. +// +// The algorithm: +// +// #1 Loop as long as we haven't reached the top-level control, and we still +// haven't found the first window-owning control. +// +// #2 If this is a window-owning control, then it's address is the +// client-side handle +// +// #3 Otherwise move up to next parent +// +// #4 If this control doesn't have paren't pointer, then try to get +// a pointer to this control's window. +// +// #5 If we got the window, then use the ClientHandle -function for +// retrieving the pointer from server side +// +// #6 If we don't have parent- or window pointers, then give up. +// --------------------------------------------------------------------------- +// +TUint32 CTouchFeedbackImpl::ClientHandle( const CCoeControl* aControl ) + { + TUint32 clientHandle = 0; + + const CCoeControl* parent = aControl; + + // #1 + while ( clientHandle == 0 && parent ) + { + if ( parent->OwnsWindow() ) + { + // #2 + clientHandle = reinterpret_cast( parent ); + } + else + { + // #3 + parent = parent->Parent(); + + if ( !parent ) + { + // #4 + RDrawableWindow* window = aControl->DrawableWindow(); + + if ( window ) + { + // #5 + TRACE("CTouchFeedbackImpl::ClientHandle - Ask handle from wserv - begin" ); + clientHandle = window->ClientHandle(); + TRACE("CTouchFeedbackImpl::ClientHandle - Ask handle from wserv - end" ); + } + else + { + // #6 + TRACE("CTouchFeedbackImpl::ClientHandle - Error: No window defined, not possible to get handle!!"); + } + + } + } + } + + return clientHandle; + } + +// --------------------------------------------------------------------------- +// We could optimize this search in case we get very many controls to the +// array, but so far it hasn't been necessary. +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackImpl::FindControlFromCache( + const CCoeControl* aControl ) + { + TInt position = KErrNotFound; + + for ( TInt i=0; i < iControlCache.Count(); i++ ) + { + if ( iControlCache[i].iControl == aControl ) + { + position = i; + break; + } + } + + return position; + } + +// --------------------------------------------------------------------------- +// If this search is starting to take too long time, then the best +// optimization would be to optimize the FindControlFromCache -function, +// as there can potentially be very many controls, but not likely very many +// ares per each control. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::FindAreaFromCache( + const CCoeControl* aControl, + TUint32 aIndex, + TInt& aCacheIndex, + TInt& aAreaIndex ) + { + aAreaIndex = KErrNotFound; + + aCacheIndex = FindControlFromCache( aControl ); + + if ( aCacheIndex >= 0 ) + { + TControlCacheEntry& entry (iControlCache[aCacheIndex]); + + for ( TInt i=0; i < entry.iAreaArray.Count(); i++ ) + { + if ( entry.iAreaArray[i].iIndex == aIndex ) + { + aAreaIndex = i; + break; + } + } + } + } + +// --------------------------------------------------------------------------- +// Here we remove the control from the cache. It is assumed that +// corresponding feedback areas have been removed from registry +// already. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::RemoveControlFromCache( TInt aControlIndex ) + { + __ASSERT_ALWAYS( + aControlIndex >= 0 && aControlIndex < iControlCache.Count(), + Panic( ETouchClientPanicArrayAccess ) ); + + iControlCache[aControlIndex].iAreaArray.Reset(); + iControlCache[aControlIndex].iAreaArray.Close(); + + iControlCache.Remove( aControlIndex ); + } + +// --------------------------------------------------------------------------- +// We have a separate function for knowing if control's feedback areas +// should be active or not, because determining this is not so simple, and +// because this part can still change. +// +// Control's areas are NOT active in case +// +// #1 Its feedback has been explicitely disabled for audio and vibra +// +// OR +// +// #2 It is not visible +// +// OR +// +// #3 It is dimmed. +// +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackImpl::ControlsAreasActive( TInt aControlIndex ) + { + __ASSERT_ALWAYS( + aControlIndex >= 0 && aControlIndex < iControlCache.Count(), + Panic( ETouchClientPanicArrayAccess ) ); + + TBool ret = ETrue; + + if ( ( iControlCache[aControlIndex].iVibraDisabled && // #1 + iControlCache[aControlIndex].iAudioDisabled ) || + !iControlCache[aControlIndex].iVisible || // #2 + iControlCache[aControlIndex].iDimmed ) // #3 + { + ret = EFalse; + } + + return ret; + } + +// --------------------------------------------------------------------------- +// This function can be used for disabling or enabling all control's +// feedback areas in the registry. +// +// #1 Find out the registry index. +// #2 In a loop, disable / enable each feedback area for this control +// #3 Maintain bookkeeping, so that we will know in the end if anything +// changed or not (so that we won't make unnecessary updates to server) +// #4 Make a pending update request if registry really changed. +// --------------------------------------------------------------------------- +// +void CTouchFeedbackImpl::DoEnableControlsAreasInRegistry( + TInt aControlIndex, + TBool aEnableVibra, + TBool aEnableAudio, + TBool aVisible ) + { + __ASSERT_ALWAYS( + aControlIndex >= 0 && aControlIndex < iControlCache.Count(), + Panic( ETouchClientPanicArrayAccess ) ); + + TBool registryChanged = EFalse; + + TControlCacheEntry& entry ( iControlCache[aControlIndex] ); + + // #1 + TInt registryIndex = FindWindowFromRegistry ( entry.iClientHandle ); + + if ( registryIndex != KErrNotFound ) + { + for ( TInt i=0; i < entry.iAreaArray.Count(); i++ ) + { + TInt id = entry.iAreaArray[i].iAreaId; + + // #2 + TBool changedNow = + iRegistryArray[registryIndex]->SetFeedbackEnabled( + id, aEnableVibra, aEnableAudio, aVisible ); + + // #3 + registryChanged = registryChanged || changedNow; + } + } + + // #4 + if ( registryChanged ) + { + iClient->RegistryChanged(); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C CFeedbackSpec* CFeedbackSpec::New() + { + return new CFeedbackSpec; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CFeedbackSpec::~CFeedbackSpec() + { + iFbArray.Close(); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CFeedbackSpec::AddFeedback( TTouchEventType aEventType, + TTouchLogicalFeedback aFeedback ) + { + // Vibra feedback is enabled by default for every event type. + TInt fbType( ETouchFeedbackVibra | ETouchFeedbackAudio ); + + return AddFeedback( aEventType, + aFeedback, + static_cast( fbType ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CFeedbackSpec::AddFeedback( TTouchEventType aEventType, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aFeedbackType ) + { + TTactileFbItem item; + if ( !(aEventType >= ETouchEventStylusDown && aEventType <= ETouchEventStylusPressUp ) ) + { + return KErrArgument; + } + item.iEventType = aEventType; + + // range check. update when logical feedback types are changed. + if (! ( aFeedback >= ETouchFeedbackNone || aFeedback <= ETouchFeedbackSensitive) + || ! ( aFeedback >= ETouchFeedbackBasicButton || + aFeedback <= ETouchFeedbackMultiTouchRecognized ) ) + { + return KErrArgument; + } + item.iFeedback = aFeedback; + item.iFeedbackType = aFeedbackType; + + iFbArray.Append(item); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CFeedbackSpec::GetFeedbackSpec( RArray& aArray ) + { + // copy values from one array to another + TInt count = iFbArray.Count(); + aArray.Reset(); // remove records from array if any + + for ( TInt i=0 ; i < count ; i++ ) + { + TTactileFbItem item; + item.iFeedback = iFbArray[i].iFeedback; + item.iEventType = iFbArray[i].iEventType; + item.iFeedbackType = iFbArray[i].iFeedbackType; + aArray.Append(item); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CFeedbackSpec::CFeedbackSpec() + { + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/src/touchfeedbackregistry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackregistry.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,294 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Local area registry management in client's process. +* Part of: Tactile Feedback. +* +*/ + +#include + +#include "touchfeedbackregistry.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackRegistry::CTouchFeedbackRegistry( TUint aWindowHandle ): + iWindowHandle( aWindowHandle ) + { + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackRegistry* CTouchFeedbackRegistry::NewL( + TUint aWindowHandle ) + { + CTouchFeedbackRegistry* self = + new( ELeave ) CTouchFeedbackRegistry ( aWindowHandle ); + + // ConstructL not needed on the moment + // --> Just return created instance right away + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTouchFeedbackRegistry::~CTouchFeedbackRegistry() + { + iAreaArray.Close(); + } + +// --------------------------------------------------------------------------- +// +// #1 If area exists already, then update it +// #2 Otherwise add it to the beginning of registry +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackRegistry::AddFeedbackAreaL( + TRect aRect, + TTouchLogicalFeedback aFeedbackTypeDown, + TTouchFeedbackType aFeedbackDown, + TTouchLogicalFeedback aFeedbackTypeUp, + TTouchFeedbackType aFeedbackUp, + TTouchEventType aEventType, + TUint aId, + TBool aVibraEnabled, + TBool aAudioEnabled, + TBool aVisible ) + { + TBool update = EFalse; + + // #1 + for ( TInt i = 0; i < iAreaArray.Count() && !update; i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + iAreaArray[i].iRect = aRect; + iAreaArray[i].iFeedbackTypeDown = aFeedbackTypeDown; + iAreaArray[i].iFeedbackDown = aFeedbackDown; + iAreaArray[i].iFeedbackTypeUp = aFeedbackTypeUp; + iAreaArray[i].iFeedbackUp = aFeedbackUp; + iAreaArray[i].iEventType = aEventType; + iAreaArray[i].iVibraEnabled = aVibraEnabled; + iAreaArray[i].iAudioEnabled = aAudioEnabled; + iAreaArray[i].iVisible = aVisible; + + update = ETrue; + } + } + + // #2 + if ( !update ) + { + TFeedbackEntry newEntry; + + newEntry.iRect = aRect; + newEntry.iFeedbackTypeDown = aFeedbackTypeDown; + newEntry.iFeedbackDown = aFeedbackDown; + newEntry.iFeedbackTypeUp = aFeedbackTypeUp; + newEntry.iFeedbackUp = aFeedbackUp; + newEntry.iEventType = aEventType; + newEntry.iId = aId; + newEntry.iVibraEnabled = aVibraEnabled; + newEntry.iAudioEnabled = aAudioEnabled; + newEntry.iVisible = aVisible; + + iAreaArray.AppendL( newEntry ); + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTouchFeedbackRegistry::RemoveFeedbackArea( TUint aId ) + { + for ( TInt i = 0; i < iAreaArray.Count(); i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + iAreaArray.Remove( i ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackRegistry::ChangeFeedbackArea( + TUint aId, + TRect aNewRect ) + { + TBool changed = EFalse; + + for ( TInt i = 0; i < iAreaArray.Count(); i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + // Check if we really have to change something + if ( iAreaArray[i].iRect != aNewRect ) + { + iAreaArray[i].iRect = aNewRect; + + changed = ETrue; + } + + // Anyway break out from the loop, as we found the area + // already + break; + } + } + + return changed; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackRegistry::ChangeFeedbackType( + TUint aId, + TTouchLogicalFeedback aNewFeedbackTypeDown, + TTouchLogicalFeedback aNewFeedbackTypeUp ) + { + TBool changed = EFalse; + + for ( TInt i = 0; i < iAreaArray.Count(); i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + // Check if we really have to change something + if ( iAreaArray[i].iFeedbackTypeDown != aNewFeedbackTypeDown ) + { + iAreaArray[i].iFeedbackTypeDown = aNewFeedbackTypeDown; + changed = ETrue; + } + if ( aNewFeedbackTypeUp != 0xFFFFFFFF && + iAreaArray[i].iFeedbackTypeUp != aNewFeedbackTypeUp ) + { + iAreaArray[i].iFeedbackTypeUp = aNewFeedbackTypeUp; + changed = ETrue; + } + + // Anyway break out from the loop, as we found the area + // already + break; + } + } + + return changed; + } + +// --------------------------------------------------------------------------- +// Areas are moved to server side starting from last position +// --> We need to make the desired area the last one in the array. +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackRegistry::MoveFeedbackAreaToFirstPriority( TUint aId ) + { + TInt ret = KErrNotFound; + + for ( TInt i = 0; i < iAreaArray.Count(); i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + TFeedbackEntry tmpEntry = iAreaArray[i]; + + TInt lastPosition = iAreaArray.Count()-1; + + iAreaArray[i] = iAreaArray[lastPosition]; + iAreaArray[lastPosition] = tmpEntry; + + ret = KErrNone; + + break; + } + } + + return ret; + } + +// --------------------------------------------------------------------------- +// Here we set the new enabled / disabled state for this area. +// +// We also return ETrue if the status really changed. This way caller of this +// function can know if any updates to server side have to be done or not. +// --------------------------------------------------------------------------- +// +TBool CTouchFeedbackRegistry::SetFeedbackEnabled( TUint aId, + TBool aVibraEnabled, + TBool aAudioEnabled, + TBool aVisible ) + { + TInt changed = EFalse; + + for ( TInt i = 0; i < iAreaArray.Count(); i++ ) + { + if ( iAreaArray[i].iId == aId ) + { + // Check if the status really changes + if ( ( iAreaArray[i].iVibraEnabled != aVibraEnabled ) || + (iAreaArray[i].iAudioEnabled != aAudioEnabled ) || + (iAreaArray[i].iVisible != aVisible )) + { + changed = ETrue; + + iAreaArray[i].iVibraEnabled = aVibraEnabled; + iAreaArray[i].iAudioEnabled = aAudioEnabled; + iAreaArray[i].iVisible = aVisible; + } + + break; + } + } + + return changed; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TUint CTouchFeedbackRegistry::WindowHandle() const + { + return iWindowHandle; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTouchFeedbackRegistry::CTouchFeedbackRegistry::AreaCount() + { + return iAreaArray.Count(); + } + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +RArray* CTouchFeedbackRegistry::WindowRegistry() + { + return &iAreaArray; + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLIENT_INSTANT_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_CLIENT_INSTANT_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/traces/touchfeedbackclientTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/traces/touchfeedbackclientTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TOUCHFEEDBACKCLIENTTRACES_H__ +#define __TOUCHFEEDBACKCLIENTTRACES_H__ + +#define KOstTraceComponentID 0x2000b491 + +#define TACTILE_CLIENT_INSTANT_FEEDBACK_1 0x400001 +#define TACTILE_CLIENT_INSTANT_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackclient/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackclient/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ + + 536917137 + touchfeedback + + 64 + TACTILE_PERFORMANCE + + e_TACTILE_CLIENT_INSTANT_FEEDBACK 1 + 1 + TACTILE_CLIENT_INSTANT_FEEDBACK_1 + + ../src/touchfeedbackclient.cpp + 502 + CTouchFeedbackClient + ImmediateFeedback + + + + e_TACTILE_CLIENT_INSTANT_FEEDBACK 0 + 2 + TACTILE_CLIENT_INSTANT_FEEDBACK_0 + + ../src/touchfeedbackclient.cpp + 509 + CTouchFeedbackClient + ImmediateFeedback + + + + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/bwins/tactilefeedbackresolveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/bwins/tactilefeedbackresolveru.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +EXPORTS + ??0RTactileFeedback@@QAE@XZ @ 1 NONAME ; RTactileFeedback::RTactileFeedback(void) + ??1CTactilePlayer@@UAE@XZ @ 2 NONAME ; CTactilePlayer::~CTactilePlayer(void) + ?Close@RTactileFeedback@@QAEXXZ @ 3 NONAME ; void RTactileFeedback::Close(void) + ?Connect@RTactileFeedback@@QAEHXZ @ 4 NONAME ; int RTactileFeedback::Connect(void) + ?FeedbackEnabledForDevice@RTactileFeedback@@QAEXAAW4TTouchFeedbackType@@@Z @ 5 NONAME ; void RTactileFeedback::FeedbackEnabledForDevice(enum TTouchFeedbackType &) + ?MaxLevel@CTactilePlayer@@UAEHXZ @ 6 NONAME ; int CTactilePlayer::MaxLevel(void) + ?ModifyFeedback@CTactilePlayer@@UAEHH@Z @ 7 NONAME ; int CTactilePlayer::ModifyFeedback(int) + ?ModifyFeedback@RTactileFeedback@@QAEXH@Z @ 8 NONAME ; void RTactileFeedback::ModifyFeedback(int) + ?ModifyPreviewFeedback@RTactileFeedback@@QAEXH@Z @ 9 NONAME ; void RTactileFeedback::ModifyPreviewFeedback(int) + ?PlayFeedback@RTactileFeedback@@QAEXW4TTouchLogicalFeedback@@HH@Z @ 10 NONAME ; void RTactileFeedback::PlayFeedback(enum TTouchLogicalFeedback, int, int) + ?PlayPreviewFeedback@CTactilePlayer@@UAEHHW4TTouchLogicalFeedback@@@Z @ 11 NONAME ; int CTactilePlayer::PlayPreviewFeedback(int, enum TTouchLogicalFeedback) + ?PlayPreviewFeedback@RTactileFeedback@@QAEXHW4TTouchLogicalFeedback@@W4TTouchFeedbackType@@@Z @ 12 NONAME ; void RTactileFeedback::PlayPreviewFeedback(int, enum TTouchLogicalFeedback, enum TTouchFeedbackType) + ?SetFeedbackEnabledForDevice@RTactileFeedback@@QAEHW4TTouchFeedbackType@@@Z @ 13 NONAME ; int RTactileFeedback::SetFeedbackEnabledForDevice(enum TTouchFeedbackType) + ?StartFeedback@CTactilePlayer@@UAEHW4TTouchContinuousFeedback@@H@Z @ 14 NONAME ; int CTactilePlayer::StartFeedback(enum TTouchContinuousFeedback, int) + ?StartFeedback@RTactileFeedback@@QAEXW4TTouchContinuousFeedback@@H@Z @ 15 NONAME ; void RTactileFeedback::StartFeedback(enum TTouchContinuousFeedback, int) + ?StartPreviewFeedback@CTactilePlayer@@UAEHHW4TTouchContinuousFeedback@@H@Z @ 16 NONAME ; int CTactilePlayer::StartPreviewFeedback(int, enum TTouchContinuousFeedback, int) + ?StartPreviewFeedback@RTactileFeedback@@QAEXHW4TTouchContinuousFeedback@@HW4TTouchFeedbackType@@@Z @ 17 NONAME ; void RTactileFeedback::StartPreviewFeedback(int, enum TTouchContinuousFeedback, int, enum TTouchFeedbackType) + ?StopFeedback@CTactilePlayer@@UAEXXZ @ 18 NONAME ; void CTactilePlayer::StopFeedback(void) + ?StopFeedback@RTactileFeedback@@QAEXXZ @ 19 NONAME ; void RTactileFeedback::StopFeedback(void) + ?StopPreviewFeedback@CTactilePlayer@@UAEXXZ @ 20 NONAME ; void CTactilePlayer::StopPreviewFeedback(void) + ?StopPreviewFeedback@RTactileFeedback@@QAEXXZ @ 21 NONAME ; void RTactileFeedback::StopPreviewFeedback(void) + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/data/tactilefeedbackeffects.ivt Binary file tactilefeedback/tactilefeedbackresolver/data/tactilefeedbackeffects.ivt has changed diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/data/ui-pen_down04.wav Binary file tactilefeedback/tactilefeedbackresolver/data/ui-pen_down04.wav has changed diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/eabi/tactilefeedbackresolveru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/eabi/tactilefeedbackresolveru.def Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,34 @@ +EXPORTS + _ZN14CTactilePlayer12StopFeedbackEv @ 1 NONAME + _ZN14CTactilePlayer13StartFeedbackE24TTouchContinuousFeedbacki @ 2 NONAME + _ZN14CTactilePlayer14ModifyFeedbackEi @ 3 NONAME + _ZN14CTactilePlayer19PlayPreviewFeedbackEi21TTouchLogicalFeedback @ 4 NONAME + _ZN14CTactilePlayer19StopPreviewFeedbackEv @ 5 NONAME + _ZN14CTactilePlayer20StartPreviewFeedbackEi24TTouchContinuousFeedbacki @ 6 NONAME + _ZN14CTactilePlayer8MaxLevelEv @ 7 NONAME + _ZN14CTactilePlayerD0Ev @ 8 NONAME + _ZN14CTactilePlayerD1Ev @ 9 NONAME + _ZN14CTactilePlayerD2Ev @ 10 NONAME + _ZN16RTactileFeedback12PlayFeedbackE21TTouchLogicalFeedbackii @ 11 NONAME + _ZN16RTactileFeedback12StopFeedbackEv @ 12 NONAME + _ZN16RTactileFeedback13StartFeedbackE24TTouchContinuousFeedbacki @ 13 NONAME + _ZN16RTactileFeedback14ModifyFeedbackEi @ 14 NONAME + _ZN16RTactileFeedback19PlayPreviewFeedbackEi21TTouchLogicalFeedback18TTouchFeedbackType @ 15 NONAME + _ZN16RTactileFeedback19StopPreviewFeedbackEv @ 16 NONAME + _ZN16RTactileFeedback20StartPreviewFeedbackEi24TTouchContinuousFeedbacki18TTouchFeedbackType @ 17 NONAME + _ZN16RTactileFeedback21ModifyPreviewFeedbackEi @ 18 NONAME + _ZN16RTactileFeedback24FeedbackEnabledForDeviceER18TTouchFeedbackType @ 19 NONAME + _ZN16RTactileFeedback27SetFeedbackEnabledForDeviceE18TTouchFeedbackType @ 20 NONAME + _ZN16RTactileFeedback5CloseEv @ 21 NONAME + _ZN16RTactileFeedback7ConnectEv @ 22 NONAME + _ZN16RTactileFeedbackC1Ev @ 23 NONAME + _ZN16RTactileFeedbackC2Ev @ 24 NONAME + _ZTI14CTactilePlayer @ 25 NONAME ; ## + _ZTI19CTactileFeedbackSrv @ 26 NONAME ; ## + _ZTI23CTactileFeedbackSession @ 27 NONAME ; ## + _ZTI24CTactileFeedbackResolver @ 28 NONAME ; ## + _ZTV14CTactilePlayer @ 29 NONAME ; ## + _ZTV19CTactileFeedbackSrv @ 30 NONAME ; ## + _ZTV23CTactileFeedbackSession @ 31 NONAME ; ## + _ZTV24CTactileFeedbackResolver @ 32 NONAME ; ## + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This component maps logical feedback types to physical +* feedback effects, and plays the correct effect according +* to current settings and system state. +* Part of: Tactile Feedback. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../data/TactileFeedbackEffects.ivt /epoc32/data/z/private/10003B20/TactileFeedbackEffects.ivt +../data/TactileFeedbackEffects.ivt /epoc32/release/winscw/udeb/Z/private/10003B20/TactileFeedbackEffects.ivt + +// IBY file +../rom/tactilefeedbackresolver.iby CORE_IBY_EXPORT_PATH(mw, tactilefeedbackresolver.iby) + +// Private interfaces +../inc/tactilefeedbackresolver.h |../../inc/tactilefeedbackresolver.h +../inc/tactilefeedbackinternalpskeys.h |../../inc/tactilefeedbackinternalpskeys.h +../inc/tactilefeedbackprivatecrkeys.h |../../inc/tactilefeedbackprivatecrkeys.h +../inc/tactilefeedbackdomaincrkeys.h |../../inc/tactilefeedbackdomaincrkeys.h +../inc/tactilepropertyobserver.h |../../inc/tactilepropertyobserver.h +../inc/tactilepropertywatcher.h |../../inc/tactilepropertywatcher.h + + +#ifndef TOOLS + +PRJ_MMPFILES +../group/tactilefeedbackresolver.mmp + +#endif // TOOLS diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/group/tactilefeedbackresolver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/group/tactilefeedbackresolver.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This component maps logical feedback types to physical +* feedback effects, and plays the correct effect according +* to current settings and system state. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +TARGET tactilefeedbackresolver.dll +TARGETTYPE DLL +UID 0x1000008d 0x2000B494 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src + +SOURCE tactileplayer.cpp +SOURCE tactilefeedbackresolver.cpp +SOURCE tactilepropertywatcher.cpp +SOURCE tactilefeedbacksession.cpp +SOURCE tactilefeedbacksrv.cpp +SOURCE tactilefeedback.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY ecom.lib diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackdefs.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,51 @@ +/* +* 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: Tactile Feedback server constants definitions. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILEFEEDBACKDEFS_H +#define TACTILEFEEDBACKDEFS_H + +_LIT( KTactileThreadName, "FeedbackPlayerThread"); +_LIT( KTactileFeedbackServer, "TactileFeedbackServer" ); + +const TInt KTactileFeedbackServerMinor = 0; +const TInt KTactileFeedbackServerMajor = 1; +const TInt KTactileFeedbackServerBuild = 0; + +const TInt KPlayerThreadStackSize = 0x4000; // 16kB +const TInt KPlayerThreadHeapMinSize = 0x1000; // 4kB +const TInt KPlayerThreadHeapMaxSize = 0x100000; // 1MB + + +enum TTactileFeedbackCmd // Server commands. + { + EPlayFeedback, + EStartFeedback, + EModifyFeedback, + EStopFeedback, + ESetFBEnabledDevice, + EFBEnabledForDevice, + EPlayPreviewFeedback, + EStartPreviewFeedback, + EModifyPreviewFeedback, + EStopPreviewFeedback + }; + +#endif // TACTILEFEEDBACKDEFS_H + +// End of file. diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackdomaincrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackdomaincrkeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CR Keys for the configurable parameters related to physical +* vibrator and audio feedback effects played by +* Tactile Feedback Resolver +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILEFEEDBACKDOMAINCRKEYS_H +#define TACTILEFEEDBACKDOMAINCRKEYS_H + +#include + + +// ============================================================================= +// General Tactile feedback -related configuration options +// +// These settings are customizable but not changeable by end user +// ============================================================================= +const TUid KCRUidTactileFeedback = {0x2000B494}; + + +/** +* Base level of vibra feedback strength +* +* Possible values are: +* 0-100 +* +* Default value: 50 +**/ +const TUint32 KTactileFeedbackHapticsStrength = 0x00000013; + +/** +* Base level of audio feedback volume +* +* Possible values are: +* 0-100 +* +* Default value: 2 +**/ +const TUint32 KTactileFeedbackAudioVolume = 0x00000014; + +/** +* Full path of the IVT file, which is used to play haptics effects. +* +* Possible values are: +* Valid path to IVT file. +* +* Default value: "z:\\private\\10003B20\\tactilefeedbackeffects.ivt" +**/ +const TUint32 KTactileHapticsIVTFile = 0x00000015; + +/** +* Number of steps used to adjust vibra feedback strength +* +* Possible values are: +* 1-100 +* +* Default value: 10 +**/ +const TUint32 KTactileFeedbackVibraLevels = 0x00000016; + +/** +* Number of steps used to adjust audio feedback volume +* +* Possible values are: +* 1-100 +* +* Default value: 3 +**/ +const TUint32 KTactileFeedbackAudioLevels = 0x00000017; + +#endif // TACTILEFEEDBACKDOMAINCRKEYS_H + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackinternalpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackinternalpskeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Private Publish & Subscribe keys of Tactile Feedback +* subsystem +* Part of: Tactile Feedback. +* +*/ + + + +#ifndef TACTILEFEEDBACKINTERNALPSKEYS_H +#define TACTILEFEEDBACKINTERNALPSKEYS_H + +#include + +/** + * We are using the system category value, because it is below + * KUidSecurityThresholdCategoryValue, and thus the property can be defined + * from any process with WriteDeviceData -capability, regardless of + * whether the process' SID matches this category. + */ +const TUid KPSUidTactileFeedback = { KUidSystemCategoryValue }; + +/** + * KTactileFeedbackEnabled + * Can be used for temporarily disabling tactile feedback in whole + * system. Should be used in situations such as a telephone call, + * where tactile feedback can cause disturbing noice on the other + * end of the telephone call. + * + * Writing to this property is protected by WriteDeviceData + * capability. + * + * Audio- and vibra feedback can be disabled separately. + * Vibra is controlled by bit 0 and audio by bit 1 in the key. + * + * The Id used is the UID of Tactile Feedback Resolver + * + * Possible values: + * 0x00: Tactile feedback is currently disabled + * 0x01: Tactile vibra feedback is enabled, audio disabled + * 0x02: Tactile vibra feedback is disabled and audio enabled. + * 0x03: Both Tactile vibra- and audio feedback are enabled. + */ +const TUint32 KTactileFeedbackEnabled = 0x2000B494; + + +#endif // TACTILEFEEDBACKINTERNALPSKEYS_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackprivatecrkeys.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,699 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CR Keys for the configurable parameters related to physical +* vibrator and audio feedback effects played by +* Tactile Feedback Resolver +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILEFEEDBACKPRIVATECRKEYS_H +#define TACTILEFEEDBACKPRIVATECRKEYS_H + +#include +#include "tactilefeedbackdomaincrkeys.h" + + +/** +* Minimun allowed interval of physical feedback effects +* +* This key can be used for filtering the feedback requests in case that is +* required by device HW. For example: When painting text in editors, it is +* possible to generate dozens of feedback requests in a second. This may feel +* very unpleasant to end user. +* +* This key defines the minimum time that must have passed since previous +* feedback request, or otherwise feedback request is ignored. +* +* If this key value is defined to zero, then this feature is disabled (i.e. +* all feedbacks are played no matter how fast they come). +* +* Possible values are: +* Integer value that represents the minimum interval in milliseconds, or +* zero for disabling the feature. +* +* Default value: 50ms +**/ +const TUint32 KTactileFeedbackMinimumInterval = 0x0000001F; + +// ============================================================================= +// Configuration options related to vibrator parameters +// +// These settings are customizable but not changeable by end user +// ============================================================================= + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel1. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 10 +**/ +const TUint32 KTactileVibraIntensityBasicLevel1 = 0x00000020; + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel2. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 40 +**/ +const TUint32 KTactileVibraIntensityBasicLevel2 = 0x00000021; + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel3. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 40 +**/ +const TUint32 KTactileVibraIntensityBasicLevel3 = 0x00000022; + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel1. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 15 +**/ +const TUint32 KTactileVibraDurationBasicLevel1 = 0x00000023; + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel2. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 20 +**/ +const TUint32 KTactileVibraDurationBasicLevel2 = 0x00000024; + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackBasic +* and vibra effect level ETactileFeedbackVibraLevel3. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 30 +**/ +const TUint32 KTactileVibraDurationBasicLevel3 = 0x00000025; + + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel1. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 50 +**/ +const TUint32 KTactileVibraIntensitySensitiveLevel1 = 0x00000026; + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel2. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 100 +**/ +const TUint32 KTactileVibraIntensitySensitiveLevel2 = 0x00000027; + +/** +* Vibra intensity setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel3. +* +* Possible values are: +* Integers from 0 to 100. See HWRMVibra.h for more information. +* Zero intensity will disable this logical feedback type. +* +* Default value: 10 +**/ +const TUint32 KTactileVibraIntensitySensitiveLevel3 = 0x00000028; + + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel1. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 5 +**/ +const TUint32 KTactileVibraDurationSensitiveLevel1 = 0x00000029; + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel2. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 10 +**/ +const TUint32 KTactileVibraDurationSensitiveLevel2 = 0x0000002a; + +/** +* Vibra duration setting for logical feedback type ETouchFeedbackSensitive +* and vibra effect level ETactileFeedbackVibraLevel3. +* +* Duration is given in milliseconds, and zero value will disable this +* logical feedback type. +* +* Possible values are: +* Integer values from zero upwards. +* +* Default value: 15 +**/ +const TUint32 KTactileVibraDurationSensitiveLevel3 = 0x0000002b; + + + +// ============================================================================= +// Configuration options related to audio tone parameters +// +// These settings are customizable but not changeable by end user +// ============================================================================= + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqBasicLevel1 = 0x00000040; + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqBasicLevel2 = 0x00000041; + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqBasicLevel3 = 0x00000042; + +/** +* Audio duration setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationBasicLevel1 = 0x00000043; + +/** +* Audio duration setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationBasicLevel2 = 0x00000044; + +/** +* Audio duration setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationBasicLevel3 = 0x00000045; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 20 +**/ +const TUint32 KTactileAudioToneVolumeBasicLevel1 = 0x00000046; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 40 +**/ +const TUint32 KTactileAudioToneVolumeBasicLevel2 = 0x00000047; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackBasic +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 60 +**/ +const TUint32 KTactileAudioToneVolumeBasicLevel3 = 0x00000048; + + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqSensitiveLevel1 = 0x00000049; + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqSensitiveLevel2 = 0x0000004a; + +/** +* Audio frequency setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Frequency is given in Hz. +* +* Possible values are: +* Positive integer values. +* +* Default value: 1100 +**/ +const TUint32 KTactileAudioToneFreqSensitiveLevel3 = 0x0000004b; + + +/** +* Audio duration setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationSensitiveLevel1 = 0x0000004c; + +/** +* Audio duration setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationSensitiveLevel2 = 0x0000004d; + +/** +* Audio duration setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Duration is given in milliseconds. +* +* Possible values are: +* Zero (disables this feedback type) or positive integers +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneDurationSensitiveLevel3 = 0x0000004e; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 10 +**/ +const TUint32 KTactileAudioToneVolumeSensitiveLevel1 = 0x0000004f; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 25 +**/ +const TUint32 KTactileAudioToneVolumeSensitiveLevel2 = 0x00000050; + +/** +* Audio volume setting for logical feedback type ETouchFeedbackSensitive +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioToneUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0 - 100 +* +* Default value: 40 +**/ +const TUint32 KTactileAudioToneVolumeSensitiveLevel3 = 0x00000051; + +// ============================================================================= +// Configuration options related to audio .wav feedback +// +// These settings are customizable but not changeable by end user +// ============================================================================= + +/** +* Full path of the .wav -file that is going to be used as basic feedback +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileBasicLevel1 = 0x00000080; + +/** +* Full path of the .wav -file that is going to be used as basic feedback +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileBasicLevel2 = 0x00000081; + +/** +* Full path of the .wav -file that is going to be used as basic feedback +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileBasicLevel3 = 0x00000082; + +/** +* Sound volume to be used when playing the basic .wav feedback +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 10 +**/ +const TUint32 KTactileAudioWavVolumeBasicLevel1 = 0x00000083; + +/** +* Sound volume to be used when playing the basic .wav feedback +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 30 +**/ +const TUint32 KTactileAudioWavVolumeBasicLevel2 = 0x00000084; + +/** +* Sound volume to be used when playing the basic .wav feedback +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 50 +**/ +const TUint32 KTactileAudioWavVolumeBasicLevel3 = 0x00000085; + +/** +* Full path of the .wav -file that is going to be used as sensitive feedback +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileSensitiveLevel1 = 0x00000086; + +/** +* Full path of the .wav -file that is going to be used as sensitive feedback +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileSensitiveLevel2 = 0x00000087; + +/** +* Full path of the .wav -file that is going to be used as sensitive feedback +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Possible values are: +* Valid path to .wav -file. If invalid or empty path is given, then +* no .wav feedback shall be generated for this logical feedback type. +* +* Default value: "z:\\System\\Sounds\\Digital\\ui-pen_down04.wav" +**/ +const TUint32 KTactileAudioWavFileSensitiveLevel3 = 0x00000088; + +/** +* Sound volume to be used when playing the sensitive .wav feedback +* and audio effect level ETactileFeedbackAudioLevel1. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 5 +**/ +const TUint32 KTactileAudioWavVolumeSensitiveLevel1 = 0x00000089; + +/** +* Sound volume to be used when playing the sensitive .wav feedback +* and audio effect level ETactileFeedbackAudioLevel2. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 10 +**/ +const TUint32 KTactileAudioWavVolumeSensitiveLevel2 = 0x0000008a; + +/** +* Sound volume to be used when playing the sensitive .wav feedback +* and audio effect level ETactileFeedbackAudioLevel3. +* +* Volume level is given in percentages. 100% equals to +* CMdaAudioPlayerUtility::MaxVolume, and 0% will disable this feedback type. +* +* Possible values are: +* 0-100 +* +* Default value: 25 +**/ +const TUint32 KTactileAudioWavVolumeSensitiveLevel3 = 0x0000008b; + +// ============================================================================= +// Configuration options related to Tactile player plugins. +// +// These settings are customizable but not changeable by end user +// ============================================================================= + +/** +* Implementation UID of the plugin, which is used to play haptics feedback. +* +* Possible values are: +* Implementation UID of the plugin. +* +* Default value: 536988569 (0x2001CB99) +**/ +const TUint32 KTactileHapticsPlugin = 0x00000090; + +/** +* Implementation UID of the plugin, which is used to play audio feedback. +* +* Possible values are: +* Implementation UID of the plugin. +* +* Default value: 536988573 (0x2001CB9D) +**/ +const TUint32 KTactileAudioPlugin = 0x00000091; + +/** +* Stores tactile flags bitmask: +* Bit 1: Vibra disabled during call +* Bit 2: Audio disabled during call +* Bit 3: Vibra played first +*/ +const TUint KTactileInternalSettings = 0x00000092; + +/** +* Defines bit 1 in KTactileInternalSettings. +* If this bit is 1, ongoing call will disable vibra feedback. +* If this bit is 0, ongoing call doesn't affect vibra feedback. +* By default this is 1. +*/ +const TInt KTactileInternalSettingsCallDisableVibra = 0x01; // 2^0 + +/** +* Defines bit 2 in KTactileInternalSettings. +* If this bit is 1, ongoing call will disable audio feedback. +* If this bit is 0, ongoing call doesn't affect audio feedback. +* By default this is 1. +*/ +const TInt KTactileInternalSettingsCallDisableAudio = 0x02; // 2^1 + +/** +* Defines bit 3 in KTactileInternalSettings. +* If this bit is 1, vibra feedback is played the first and +* audio feedback after that. +* If this bit is 0, audio feedback is played the first and +* vibra feedback after that. +* By default this is 1. +*/ +const TInt KTactileInternalSettingsVibraPlayedFirst = 0x04; // 2^2 + + +/** +* Logical actuator type in Tactile Haptics Player. +* +* Possible values are defined in enumeration THWRMLogicalActuators +* in file hwrmlogicalactuators.h. +* +* Default value: 1 (EHWRMLogicalActuatorAny) +*/ +const TInt KTactileFeedbackHapticsActuator = 0x00000093; + +#endif // TACTILEFEEDBACKPRIVATECRKEYS_H + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackresolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbackresolver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,285 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for resolving physical feedback type based on +* tactile feedback settings and current device state. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEFEEDBACKRESOLVER_H +#define C_TACTILEFEEDBACKRESOLVER_H + +#include +#include +#include + +#include "tactilepropertyobserver.h" + +class CRepository; +class CTactilePlayer; +class CTactilePropertyWatcher; + +/** + * Class for procuding physical feedback based on logical + * feedback type. + * + * Feedback is generated according to Tactile Feedback settings and + * current device state, and it may be that feedback is not even generated + * at all. + * + * @lib tactilefeedbackresolver.lib + * @since S60 5.2 + */ +class CTactileFeedbackResolver: public CBase, + public MTactilePropertyObserver, + public MCenRepNotifyHandlerCallback + { +public: + + static CTactileFeedbackResolver* NewL(); + + virtual ~CTactileFeedbackResolver(); + + /** + * Produces immediately physical feedback according to given + * logical feedback type. + * + * Actual physical feedback type depends on settings of existing player + * plugins and current device state. + * + * @param aFeedback - Logical feedback type. + * @param aPlayVibra - If EFalse then vibra feedback is not played. + * @param aPlayAudio - If EFalse then audio feedback is not played. + */ + void PlayFeedback( TTouchLogicalFeedback aFeedback, + TBool aPlayVibra, + TBool aPlayAudio ); + + /** + * Starts playing continuous feedback. + * + * @since S60 5.2 + * @param aType - Type of continuous feedback to be played. + * @param aIntensity - Intensity of continuous feedback. Value + * range for intensity is 0-100%. + */ + void StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ); + + /** + * Modifies the intensity of ongoing continuous feedback. + * @since S60 5.2 + * @param aIntensity - New intensity for continuous feedback. Value + * range for intensity is 0-100%. + */ + void ModifyFeedback( TInt aIntensity ); + + /** + * Stops the ongoing continuous feedback. + * + * @since S60 5.2 + */ + void StopFeedback(); + + /** + * Produces immediate physical feedback according to given + * logical feedback type and given level. + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedbackType - Logical feedback type. + * @param aType - Type of feedback to be previewed. + */ + void PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ); + + /** + * Starts playing continuous feedback of given type on given level. + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedback - Type of continuous feedback to be played. + * @param aIntensity - Intensity of continuous feedback. Value + * range for intensity is 0-100% from basic + * strength (aLevel). + * @param aType - Type of feedback to be previewed. + */ + void StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ); + + /** + * Stops the ongoing preview of continuous feedback. + * + * @since S60 5.2 + */ + void StopPreviewFeedback(); + +private: + /** + * Constructor. + */ + CTactileFeedbackResolver(); + + /** + * 2nd phase constructor.. + */ + void ConstructL(); + + /** + * Central repository related initializations. + */ + void InitializeCrKeysL(); + + /** + * Publish & Subscribe related initializations. + */ + void InitializePsKeysL(); + + /** + * This function reads the feedback enabled/disabled value from + * the dedicated P&S key, and stores it into iFeedbackEnabled + * -member variable. + * + * Dedicated fuction used for avoiding duplicate code (in + * construction and when the P&S key changes) + */ + void ReadFeedbackEnabledFromPS(); + +// from base class MTactilePropertyObserver + + /** + * From MTactilePropertyObserver + * + * This is called when the property for temporary disabling feedback + * is updated. + * + * @param aCategory - The UID of the changed property + * @param aKey - The key (i.e. identifier) of the changed property + */ + void PropertyChangedL( const TUid aCategory, + const TUint aKey ); + + +//from base class MCenRepNotifyHandlerCallback. + + /** + * From MCenRepNotifyHandlerCallback. + * + * This is called when Tactile Feedback settings in Central Repository + * are changed. + * + * @param aId - The id of the changed Central Repository value. + */ + void HandleNotifyGeneric( TUint32 aId ); + +private: + /** + * Handle changes in tactile feedback settings. + */ + void DoHandleNotifyGenericL( TUint32 aId ); + + /** + * Create haptics player. ECom implementation uid is used for selecting + * the player plugin. + */ + void CreateHapticsPlayerL( TUid aHapticsUid ); + + /** + * Create audio player. ECom implementation uid is used for selecting + * the player plugin. + */ + void CreateAudioPlayerL( TUid aAudioUid ); + +private: // data + + /** + * Access to the P&S property, which is used for temporary disabling + * the feedback. + * Own. + */ + CTactilePropertyWatcher* iPropertyWatcher; + + /** + * Haptics player. + * Own. + */ + CTactilePlayer* iHapticsPlayer; + + /** + * Audio player. + * Own. + */ + CTactilePlayer* iAudioPlayer; + + /** + * Central repository for reading tactile feedback settings. + * Own. + */ + CRepository* iRepository; + + /** + * Central repository notifier, which sends notification when tactile + * feedback settings has been changed. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + /** + * This flag indicates the vibra feedback state according to the P&S key + * that can be used for globally disabling vibra and/or audio + * feedback. + */ + TBool iVibraEnabled; + + /** + * This flag indicates the audio feedback state according to the P&S key + * that can be used for globally disabling vibra and/or audio + * feedback. + */ + TBool iAudioEnabled; + + /** + * This flag indicates whether the continuous feedback is started or not. + * + */ + TBool iFeedbackStarted; + + /** + * Minimum interval between feedbacks. + * + */ + TTimeIntervalMicroSeconds iMinimumInterval; + + /** + * Timestamp of the last played feedback. + * + */ + TTime iLastFeedbackTimeStamp; + + /** + * This flag determinates the playing order of feedback types. + * ETrue - vibra feedback is played first. + * EFalse - audio feedback is played first. + */ + TBool iVibraFirst; + }; + + +#endif // C_TACTILEFEEDBACKPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbacksession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbacksession.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,132 @@ +/* +* 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: Session class for Tactile Feedback server. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEFEEDBACKSESSION_H +#define C_TACTILEFEEDBACKSESSION_H + +#include + +class CTactileFeedbackSrv; + +/** + * Session class for Tactile Feedback server. + * + * @since S60 5.2 + */ +class CTactileFeedbackSession : public CSession2 + { +public: + /** + * C++ constructor. + */ + CTactileFeedbackSession(); + + /** + * From CSession2, passes the request forward to DispatchMessageL. + * @since S60 5.2 + * @param aMessage, a message from client. + */ + void ServiceL( const RMessage2& aMessage ); + + /** + * Handles the request from client. + * @since S60 5.2 + * @param aMessage, a message from client. + */ + void DispatchMessageL( const RMessage2& aMessage ); + + /** + * From CSession2, adds session to server's counter. + * @since S60 5.2 + */ + void CreateL(); + +private: + /** + * Play feedback. + */ + void PlayFeedback( const RMessage2& aMessage ); + + /** + * Start continuous feedback. + */ + void StartFeedback( const RMessage2& aMessage ); + + /** + * Modify continuous feedback. + */ + void ModifyFeedback( const RMessage2& aMessage ); + + /** + * Stop continuous feedback. + */ + void StopFeedback( const RMessage2& aMessage ); + + /** + * Set feedback enabled/disabled for the device. + */ + void SetFBEnabledForDeviceL( const RMessage2& aMessage ); + + /** + * Get feedback enabled/disabled state. + */ + void FeedbackEnabledForDeviceL( const RMessage2& aMessage ); + + /** + * Play preview feedback. + */ + void PlayPreviewFeedback( const RMessage2& aMessage ); + + /** + * Start preview of continuous feedback. + */ + void StartPreviewFeedback( const RMessage2& aMessage ); + + /** + * Modify preview of continuous feedback. + */ + void ModifyPreviewFeedback( const RMessage2& aMessage ); + + /** + * Stop preview of continuous feedback. + */ + void StopPreviewFeedback( const RMessage2& aMessage ); + +private: + /** + * C++ destructor. + */ + virtual ~CTactileFeedbackSession(); + + /* + * Reference to Tactile Feedback Server. + */ + CTactileFeedbackSrv& Server(); + +private: + /** + * This flag is used for making sure that continuous feedback + * is stopped if the client, which started it, is closed. + */ + TBool iFeedbackStarted; + }; + +#endif // C_TACTILEFEEDBACKSESSION_H + +// End of file. diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbacksrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilefeedbacksrv.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,230 @@ +/* +* 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: Header of tactile feedback server. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEFEEDBACKSRV_H +#define C_TACTILEFEEDBACKSRV_H + +#include +#include + +#include "tactilefeedbackresolver.h" +#include "tactilefeedbackdefs.h" + +// Total number of ranges +const TUint KTactileFeedbackRangeCount = 1; + +// Definition of the ranges of IPC numbers +const TInt KTactileFeedbackRanges[KTactileFeedbackRangeCount] = + { + 0, + }; + +// Policy to implement for each of the above ranges +const TUint8 KTactileFeedbackElementsIndex[KTactileFeedbackRangeCount] = + { + 0, + }; + +const CPolicyServer::TPolicyElement KTactileFeedbackPolicyElements[] = + { + { _INIT_SECURITY_POLICY_C2(ECapability_None, + ECapability_None), + CPolicyServer::EFailClient } + }; + +// Package all the above together into a policy +const CPolicyServer::TPolicy KTactileFeedbackPolicy = + { + CPolicyServer::EAlwaysPass, // all attempts should pass + KTactileFeedbackRangeCount, // number of ranges + KTactileFeedbackRanges, // ranges array + KTactileFeedbackElementsIndex, // elements<->ranges index + KTactileFeedbackPolicyElements, // array of elements + }; + +/** + * Tactile feedback server. + * + * @since S60 5.2 + */ +class CTactileFeedbackSrv : public CPolicyServer + { +public: + /** + * 2-phased constructor. + * + * @since S60 5.2 + * @return Instance of CTactileFeedbackSrv. + */ + static CTactileFeedbackSrv* NewL(); + + /** + * C++ destructor. + */ + virtual ~CTactileFeedbackSrv(); + +public: +// from base class CServer2. + /** + * From CServer2, creates a new session. + */ + CSession2* NewSessionL( const TVersion& aVersion, + const RMessage2& aMessage ) const; + + /** + * Increase session count. + * + * @since S60 5.2 + */ + void AddSession(); + + /** + * Decrease session count, close server if count is zero. + * + * @since S60 5.2 + */ + void RemoveSession(); + +public: + /** + * Play feedback. + * + * @since S60 5.2 + * @param aFeedback - Logical feedback type. + * @param aPlayHaptics - Boolean value, which indicates if haptics + * feedback is played. + * @param aPlayAudio - Boolean value, which indicates if audio + * feedback is played. + */ + void PlayFeedback( TTouchLogicalFeedback aFeedback, + TBool aPlayHaptics, + TBool aPlayAudio ); + + /** + * Start continuous feedback. + * + * @since S60 5.2 + * @param aType - Type of continuous feedback. + * @param aIntensity - Intensity of continuous feedback. + */ + void StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ); + + /** + * Modify continuous feedback. + * + * @since S60 5.2 + * @param aIntensity - Intensity of continuous feedback. + */ + void ModifyFeedback( TInt aIntensity ); + + /** + * Stop continuous feedback. + */ + void StopFeedback(); + + /** + * Set feedback enabled/disabled for the device. + * + * @since S60 5.2 + * @param aFeedbackType - Bitmask, which tells which feedback types + * are enabled/disabled. + */ + void EnableFeedbackForDevice( TTouchFeedbackType aFeedbackType ); + + /** + * Get a bitmask of feedback type, which indicates what feedback types + * are enabled/disabled in the device. + * + * @since S60 5.2 + * @return Bitmask, which contains currently enabled feedback types. + */ + TTouchFeedbackType FeedbackEnabledForDevice(); + + /** + * Play preview feedback. + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedback - Logical feedback type. + * @param aType - Type of feedback to be previewed. + */ + void PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ); + + /** + * Start preview of continuous feedback. + * + * @since S60 5.2 + * @param aLevel - Level value defines the strength of playing + * effect. Maximum level value is player dependent. + * @param aFeedback - Type of continuous feedback to be played. + * @param aIntensity - Intensity of continuous feedback. Value + * range for intensity is 0-100% from basic + * strength (aLevel). + * @param aType - Type of feedback to be previewed. + */ + void StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ); + + /** + * Stop preview of continuous feedback. + * + * @since S60 5.2 + */ + void StopPreviewFeedback(); + +private: + /** + * C++ constructor. + */ + CTactileFeedbackSrv(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + +private: // data + /** + * Instance of tactile feedback resolver. + * Own. + */ + CTactileFeedbackResolver* iResolver; + + /** + * Count of open sessions. + */ + TInt iSessionCount; + + /** + * A bitmap, which contains information of currently enabled/disabled + * feedback types. + */ + TInt iDeviceFeedbackEnabled; + }; + + +#endif // C_TACTILEFEEDBACKSRV_H + +// End of file. diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactileplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactileplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,242 @@ +/* +* 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: Tactile feedback player plugin interface. +* Part of: Tactile Feedback. +* +*/ + +#ifndef C_TACTILEPLAYER_H +#define C_TACTILEPLAYER_H + +#include +#include + +#include + +class CRepository; + + +/** + * Types of tactile players. This enumeration is used for listing the + * implementations of players of certain type. + * @since S60 5.2 + */ +enum TTactilePlayerType + { + ETactilePlayerAny, + ETactilePlayerHaptics, + ETactilePlayerAudio + }; + +/** + * Tactile feedback player ECom plugin interface. + * + * There are two basic types of tactile players, haptics and audio + * players. Each player must follow the player type specific settings + * from Central Repository to play feedback in the specified level. If + * playing level for haptics or audio is set to zero, players of that type + * must not produce any feedback. + * + * UID for tactile feedback settings is: + * KCRUidTactileFeedback = 0x2000B494; + * + * Players are instantiated based on plugins' implementation UIDs, which + * are read from Central Repository by feedback resolver. Player types + * are differentiated by using word "Haptics" or "Audio" in default_data + * field in plugin's implementation info resource file. + * + * Preview functions for playing immediate and starting continuous feedback + * are ment to use for example in settings view to get feedback played with + * different level without actually changing the level in settings. It is + * feedback resolver's responsibility not to play regular feedbacks when + * preview functions are used. + * + * @lib tactilefeedbackresolver.lib + * @since S60 5.2 + */ +class CTactilePlayer : public CBase + { +public: + /** + * Instantiates an object of this type. + * + * @since S60 5.2 + * @param aImplementationUid - Implementation uid of the plugin + * to be created. + * @param aRepository - Reference to Central Repository, which is + * used for reading Tactile Feedback + * settings. CR Keys for Tactile Feedback are + * defined in tactilefeedbackdomaincrkeys.h + * + * @return Instance of feedback player plugin. + */ + static CTactilePlayer* NewL( TUid aImplementationUid, + CRepository& aRepository ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CTactilePlayer(); + + /** + * Returns a list of available implementations for this + * interface. + * + * @since S60 5.2 + * @param aType - Type of players to be listed. + * @param aImplInfoArray - Implementation information array of all + * available implementations. + */ + static void ListImplementationsL( TTactilePlayerType aType, + RImplInfoPtrArray& aImplInfoArray ); + +public: + /** + * Produces immediate physical feedback according to given + * logical feedback type. + * + * Haptics and audio players have onw level value, which is + * specified in Tactile Feedback settings in Central Repository. + * That value defines the strength of feedback produced by this function. + * When settings are changed, plugin implementation must change the + * playing level according to that value. If feedback level for this + * type of player in settings is set to zero, this function must not + * produce any feedback. + * + * @since S60 5.2 + * @param aFeedback - The logical feedback type, which is used to + * select the physical response to feedback method. + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + virtual TInt PlayFeedback( TTouchLogicalFeedback aFeedback ) = 0; + + /** + * Starts continuous feedback according to given logical + * continuous feedback type. Continuous feedback is started with given + * intensity, which is a percentage value of maximum strength on current + * level. Ongoing continuous feedback can be modified using + * ModifyFeedback() to change intensity of feedback. + * + * Continuous feedback is stopped using StopFeedback(). + * + * @since S60 5.2 + * @param aFeedback - The logical feedback type of continuous feedback, + * which is used to select the physical response to + * continuous feedback method. + * @param aIntensity - The percentage value of continuous feedback's + * maximum strength. + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return TInt KErrNotSupported if player doesn't support continuous + * feedback. + */ + IMPORT_C virtual TInt StartFeedback( TTouchContinuousFeedback aFeedback, + TInt aIntensity ); + + /** + * Modifies the intensity of continuous feedback. + * + * @since S60 5.2 + * @param aIntensity - The percentage value of continuous feedback's + * intensity. + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return TInt KErrNotSupported if player doesn't support continuous + * feedback. + */ + IMPORT_C virtual TInt ModifyFeedback( TInt aIntensity ); + + /** + * Stops continuous feedback. + * + * @since S60 5.2 + */ + IMPORT_C virtual void StopFeedback(); + + /** + * Plugin's maximum feedback level, which defines the strength + * of played feedback. The amount of feedback levels is dependent on + * a plugin. + * + * Level values are used for playing preview of feedback. + * + * @since S60 5.2 + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C virtual TInt MaxLevel(); + + /** + * Produces preview of feedback according to given locigal feedback + * type and given level value of feedback strength. + * + * @since S60 5.2 + * @param aLevel - A value, which defines the strength of preview + * feedback. Preview level can be any positive + * value up to value of MaxLevel(). + * @param aFeedback - The logical feedback type, which is used to + * select the physical response to feedback method. + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return TInt KErrNotSupported if player doesn't support feedback + * preview. + */ + IMPORT_C virtual TInt PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback ); + + /** + * Starts preview of continuous feedback according to given logical + * continuous feedback type and given level value of feedback strength. + * Preview of continuous feedback is started with given intensity, + * which is a percentage value of maximum strength in given level. + * Ongoing continuous feedback can be modified using ModifyFeedback() + * to change intensity of feedback. + * + * Preview of continuous feedback is stopped using StopFeedback(). + * + * @since S60 5.2 + * @param aLevel - A value, which defines the strength of preview + * feedback. Preview level can be any positive + * value between zero and MaxLevel(). + * @param aFeedback - The logical feedback type of continuous feedback, + * which is used to select the physical response to + * continuous feedback method. + * @param aIntensity - The percentage value of continuous feedback's + * maximum strength. + * @return TInt KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return TInt KErrNotSupported if player doesn't support preview + * for continuous feedback. + */ + IMPORT_C virtual TInt StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity ); + + /** + * Stops preview of continuous feedback. Player must set the original + * level value back in this function. + * + * @since S60 5.2 + */ + IMPORT_C virtual void StopPreviewFeedback(); + +private: + + // Unique instance identifier key. + TUid iDtor_ID_Key; + + }; + +#endif // C_TACTILEPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilepropertyobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilepropertyobserver.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Callback interface for getting a notification about +* property changes. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef M_TACTILEPROPERTYOBSERVER_H +#define M_TACTILEPROPERTYOBSERVER_H + + + +#include + + +/** + * Callback interface used from CTactilePropertyWatcher. + * + * @lib N/A + * @since S60 v5.0 + */ +class MTactilePropertyObserver + { +public: + /** + * This gets called when a subscribed property is changed. + * + * @param aCategory - The UID of the changed property + * @param aKey - The key (i.e. identifier) of the changed property + */ + virtual void PropertyChangedL( const TUid aCategory, + const TUint aKey ) = 0; + }; + + + +#endif // M_TACTILEPROPERTYOBSERVER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/inc/tactilepropertywatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/inc/tactilepropertywatcher.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for monitoring changes in P&S keys. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILEPROPERTYWATCHER_H +#define TACTILEPROPERTYWATCHER_H + + +#include +#include +#include + +#include "tactilepropertyobserver.h" + + + +/** + * Observer class for accessing to P&S property values, and listening + * to changes. + * + * @lib tactilefeedbackresolver.lib + * @since S60 v5.0 + */ +NONSHARABLE_CLASS( CTactilePropertyWatcher ): public CActive + { +public: + + /** + * Intantiation method. + * + * This will create a property wather active + * object with given active object priority. + * + * @param aObserver - Reference to observer interface. + * @param aCategory - P&S category, where the observed key is. + * @param aKey - Observed P&S key. + * @param aPriority - Active object priority, which is given to + * this wather instance. + * @return New property watcher instance. + */ + static CTactilePropertyWatcher* NewL( + MTactilePropertyObserver& aObserver, + const TUid aCategory, + const TInt aKey, + CActive::TPriority aPriority ); + + ~CTactilePropertyWatcher(); + + + /** + * Retrieves an integer value associated with this property. + * + * Leaves with Standard Symbian OS error codes in case + * retreving of the value fails. + * + * @param aValue - The property value is returned here + */ + void GetL( TInt& aValue ); + + /** + * Fills aValue with the buffer associated with this property. + * + * Leaves with Standard Symbian OS error codes in case + * retreving of the value fails. + * + * @param aValue - The property value is returned here + */ + void GetL( TDes8& aValue ); + + /** + * Retrieves an integer value associated with this property. + * + * Does not leave in case reading of the property fails, but + * instead returns Standard Symbian OS error code. + * + * @param aValue the property value is returned here + * @return standard Symbian OS error code + */ + TInt Get( TInt& aValue ); + + /** + * Fills aValue with the buffer associated with this property. + * + * Does not leave in case reading of the property fails, but + * instead returns Standard Symbian OS error code. + * + * @param aValue the property value is returned here + * @return standard Symbian OS error code + */ + TInt Get( TDes8& aValue ); + + /** + * Sets a P&S property to an integer value. The property must be + * already defined. + * + * @param aValue - The integer value to set to the property + */ + void SetL( const TInt aValue ); + + + /** + * Sets a P&S property to a (large) bytearray value. The property + * must be already defined. + * + * @param aValue - The integer value to set to the property + */ + void SetL( const TDesC8& aValue ); + +private: + + CTactilePropertyWatcher( + MTactilePropertyObserver& aObserver, + const TUid aCategory, + const TInt aKey, + CActive::TPriority aPriority ); + + void ConstructL(); + + void Subscribe(); + + + // from base class CActive + + /** + * Standard DoCancel of an active object. + */ + void DoCancel(); + + /** + * Standard RunL of an active object. + */ + void RunL(); + +private: // data + + /** + * Access to observer interface + * Not own. + */ + MTactilePropertyObserver& iObserver; + + /** + * The UID of this property + */ + TUid iCategory; + + /** + * The key of this property + */ + TUint iKey; + + /** + * Handle to the attached property + * Own. + */ + RProperty iProperty; + }; + + +#endif // TACTILEPROPERTYWATCHER_H + +// End of File + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,36 @@ +/* +* 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 information file for tactile player plug-ins. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// IBY files +../tactileaudioplugin/rom/tactileaudioplugin.iby CORE_IBY_EXPORT_PATH(mw, tactileaudioplugin.iby) +../tactilehapticsplugin/rom/tactilehapticsplugin.iby CORE_IBY_EXPORT_PATH(mw, tactilehapticsplugin.iby) +../tactiletoneplugin/rom/tactiletoneplugin.iby CORE_IBY_EXPORT_PATH(mw, tactiletoneplugin.iby) +../tactilevibraplugin/rom/tactilevibraplugin.iby CORE_IBY_EXPORT_PATH(mw, tactilevibraplugin.iby) + +PRJ_MMPFILES +../tactilehapticsplugin/group/tactilehapticsplugin.mmp +../tactiletoneplugin/group/tactiletoneplugin.mmp +../tactilevibraplugin/group/tactilevibraplugin.mmp +../tactileaudioplugin/group/tactileaudioplugin.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/data/20021339.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/data/20021339.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: ECom registration file for Tactile Audio player plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 20021339; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x2001CBA7; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2002133A; + version_no = 1; + display_name = ""; + default_data = "Audio"; + opaque_data = ""; + } + }; + } + }; + } + +// End of file \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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 information file for tactile audio plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// IBY file +../rom/tactileaudioplugin.iby CORE_IBY_EXPORT_PATH(mw, tactileaudioplugin.iby) + +PRJ_MMPFILES +tactileaudioplugin.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/group/tactileaudioplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/group/tactileaudioplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Audio Feedback player plugin. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +TARGET tactileaudioplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20021339 + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactileaudioplayer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 20021339.rss +TARGETPATH ECOM_RESOURCE_DIR +TARGET tactileaudioplugin.rsc +END + + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY mediaclientaudiostream.lib +LIBRARY tactilefeedbackresolver.lib diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/inc/tactileaudioplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/inc/tactileaudioplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing audio feedback. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEAUDIOPLAYER_H +#define C_TACTILEAUDIOPLAYER_H + + +#include +#include +#include +#include + +#include "tactileplayer.h" + + +/** + * Class for procuding audio feedback based on logical + * feedback type. + * + * @lib tactileaudioplugin.lib + * @since S60 5.2 + */ + +NONSHARABLE_CLASS( CTactileAudioPlayer ): public CTactilePlayer, + public MCenRepNotifyHandlerCallback, + public MMdaAudioOutputStreamCallback + { +public: + /** Possible states of this player */ + enum TTactileAudioWavState + { + ETactileAudioInitialising, + ETactileAudioError, + ETactileAudioReady, + ETactileAudioPlaying + }; + + /** + * 2-phased constructor. + * @param aRepository - Reference to Central Repository. + * @return Instance of CTactileAudioPlayer. + */ + static CTactileAudioPlayer* NewL( CRepository& aRepository ); + + /** + * Destructor. + */ + virtual ~CTactileAudioPlayer(); + +private: // from base class CTactilePlayer + /** + * @see CTactilePlayer. + */ + TInt PlayFeedback( TTouchLogicalFeedback aFeedback ); + + /** + * @see CTactilePlayer. + */ + TInt PlayPreviewFeedback( TInt aLevel, TTouchLogicalFeedback aFeedback ); + +private: // From MMdaAudioOutputStreamCallback. + + /** + * @see MMdaAudioOutputStreamCallback. + */ + void MaoscOpenComplete( TInt aError ); + + /** + * @see MMdaAudioOutputStreamCallback. + */ + void MaoscBufferCopied( TInt aError, const TDesC8 &aBuffer ); + + /** + * @see MMdaAudioOutputStreamCallback. + */ + void MaoscPlayComplete( TInt aError ); + +private: // From MCenRepNotifyHandlerCallback. + + /** + * @see MCenRepNotifyHandlerCallback. + */ + void HandleNotifyInt( TUint32 aId, TInt aNewValue ); + +private: + /** + * Read new settings values. + */ + void ReadSettingsL(); + + /** + * Scale volume. + */ + TInt ScaledVolume(); + + /** + * Creation of the actual player is handled inside this function. It + * it assumed that current settings have been read to members + * iFileName and iVolumeLevels before calling this function. + */ + void CreateWavPlayerL(); + + /** + * Read audio sample. + */ + void ReadSampleL( RFile& aFile, HBufC8*& aDes, TUint& aChannels, TUint& aSampleRate ); + +private: + /** + * Constructor. + */ + CTactileAudioPlayer( CRepository& aRepository ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + +private: // data + + /** + * Descriptor for wav file used for basic feedback. + * Own. + */ + HBufC8* iBasicSample; + + /** + * Descriptor for wav file used for sensitive feedback. + * Own. + */ + HBufC8* iSensitiveSample; + + /** + * Maximum raw volume value supported by audio hardware + * interface. Stored to member variable to avoid MMFAudioClient:2 + * panic. Possibly even increases performance, if ever so slightly. + */ + TInt iMaxRawVolume; + + /** + * Audio channels. + */ + TUint iChannels; + + /** + * Audio sample rate.. + */ + TUint iSampleRate; + + /** + * Current state of this class + */ + TTactileAudioWavState iState; + + /** + * Access to audio player utility + * Own. + */ + CMdaAudioOutputStream* iAudioPlayer; + + /** + * Name of the .wav -file to be used as sensitive effect + * Own. + */ + HBufC* iSensitiveFileName; + + /** + * Name of the .wav -file to be used as basic effect + * Own. + */ + HBufC* iBasicFileName; + + /** + * Current volume level + */ + TInt iCurrentVolume; + + /** + * Original volume is saved here in preview playing. + */ + TInt iOriginalVolume; + + /** + * Volume levels for different logical feedbacks. + */ + RArray iVolumeLevels; + + /** + * Access to settings. + * Not own. + */ + CRepository& iRepository; + + /** + * Utility for listening to changes in configurable parameters. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + }; + + +#endif // C_TACTILEAUDIOPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/rom/tactileaudioplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/rom/tactileaudioplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: This is the IBY file for Tactile Audio plugin. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILEAUDIOPLUGIN_IBY +#define TACTILEAUDIOPLUGIN_IBY + +#include + +ECOM_PLUGIN(tactileaudioplugin.dll,tactileaudioplugin.rsc) + +#endif // TACTILEAUDIOPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/src/tactileaudioplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/src/tactileaudioplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,690 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for producing audio feedback. +* Part of: Tactile Feedback. +* +*/ + + +#include + +#include +#include + +#include +#include +#include + +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbacktrace.h" + +#include "tactileaudioplayer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactileaudioplayerTraces.h" +#endif + +const TInt KRiffHeaderSize = 44; +_LIT8( KRiff, "RIFF" ); +_LIT8( KWave, "WAVE" ); +_LIT8( KFmt, "fmt " ); +_LIT8( KData, "data" ); + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactileAudioPlayer::CTactileAudioPlayer( CRepository& aRepository ): + iRepository( aRepository ) + { + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::ConstructL() + { + TRACE("CTactileAudioPlayer::ConstructL()"); + + ReadSettingsL(); + + CreateWavPlayerL(); + + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, + iRepository, + CCenRepNotifyHandler::EIntKey, + KTactileFeedbackAudioVolume ); + iCenRepNotifier->StartListeningL(); + + TRACE("CTactileAudioPlayer::ConstructL() - end"); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactileAudioPlayer* CTactileAudioPlayer::NewL( CRepository& aRepository ) + { + CTactileAudioPlayer* self = + new ( ELeave ) CTactileAudioPlayer( aRepository ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileAudioPlayer::~CTactileAudioPlayer() + { + if ( iAudioPlayer ) + { + iAudioPlayer->Stop(); + delete iAudioPlayer; + } + + delete iCenRepNotifier; + delete iSensitiveSample; + delete iBasicSample; + delete iSensitiveFileName; + delete iBasicFileName; + + iVolumeLevels.Close(); + } + + +// --------------------------------------------------------------------------- +// From class CTactilePlayer +// +// Currently we only select volume level according to logical feedback type +// (i.e. the .wav -file cannot be selected separately for each logical +// feedback type). +// +// We don't do anything in case volume level has been set to zero for the +// given feedback type (this way e.g. dragging feedback can be disabled +// totally if that is wanted). +// +// Notice that currently the ETouchFeedbackSensitive -feedback is a bit +// troublesome: Even though we have our own thread for feedback playing, +// it still lags behind when something is dragged on screen. Final solution +// may be to configure audio .wav dragging feedback OFF, and use audio +// tone for dragging instead. +// --------------------------------------------------------------------------- +// +TInt CTactileAudioPlayer::PlayFeedback( TTouchLogicalFeedback aFeedback ) + { + TRACE2( "CTactileAudioPlayer::PlayFeedback( %d )", aFeedback ); + TInt volumeIndex(0); + + switch ( aFeedback ) + { + case ETouchFeedbackBasic: // flow through + case ETouchFeedbackBasicButton: // flow through + case ETouchFeedbackList: // flow through + case ETouchFeedbackBoundaryList: // flow through + case ETouchFeedbackSlider: // flow through + case ETouchFeedbackEdit: // flow through + case ETouchFeedbackSensitiveInput: + case ETouchFeedbackLineSelection: // flow through + case ETouchFeedbackBlankSelection: // flow through + case ETouchFeedbackTextSelection: // flow through + case ETouchFeedbackEmptyLineSelection: // flow through + case ETouchFeedbackTab: // flow through + case ETouchFeedbackPopUp: // flow through + case ETouchFeedbackIncreasingPopUp: // flow through + case ETouchFeedbackDecreasingPopUp: // flow through + case ETouchFeedbackFlick: // flow through + case ETouchFeedbackCheckbox: // flow through + case ETouchFeedbackCharacterInputButton: + case ETouchFeedbackMultiTouchRecognized: + volumeIndex = 0; + break; + case ETouchFeedbackSensitive: // flow through + case ETouchFeedbackSensitiveButton: // flow through + case ETouchFeedbackSensitiveList: + volumeIndex = 1; + break; + default: + // should not be there at all + TRACE2( "CTactileAudioPlayer::PlayFeedback - %d is not a feedback type - returning", aFeedback ); + break; + } + + + if ( volumeIndex <= iVolumeLevels.Count() && + iVolumeLevels[volumeIndex] > 0 && + iAudioPlayer ) + { + switch ( iState ) + { + case ETactileAudioInitialising: + // can't play anything yet + break; + case ETactileAudioPlaying: // fall trough + case ETactileAudioReady: + OstTrace1( TACTILE_PERFORMANCE, TACTILE_PLAY_AUDIO_FEEDBACK_1, + "e_TACTILE_PLAY_AUDIO_FEEDBACK 1 0x%x", aFeedback ); + + if ( aFeedback == ETouchFeedbackBasic ) + { + TRAP_IGNORE( iAudioPlayer->WriteL( *iBasicSample ) ); + } + else + { + TRAP_IGNORE( iAudioPlayer->WriteL( *iSensitiveSample ) ); + } + OstTrace1( TACTILE_PERFORMANCE, TACTILE_PLAY_AUDIO_FEEDBACK_0, + "e_TACTILE_PLAY_AUDIO_FEEDBACK 0 0x%x", aFeedback ); + iState = ETactileAudioPlaying; + break; + case ETactileAudioError: + break; + default: + // should not be here + TRACE("CTactileAudioPlayer::PlayFeedback - error with audio device"); + break; + + } + + } + else + { + if ( !iAudioPlayer ) + { + TRACE("CTactileAudioPlayer::PlayFeedback - iAudioPlayer is NULL!"); + } + else + { + TRACE("CTactileAudioPlayer::PlayFeedback - volume levels not ok"); + } + } + TRACE2( "CTactileAudioPlayer::PlayFeedback( %d ) - end", aFeedback ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTactileAudioPlayer::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback ) + { + TRACE("CTactileAudioPlayer::PlayPreviewFeedback - Begin"); + TInt ret( KErrArgument ); + + iOriginalVolume = iCurrentVolume; + iCurrentVolume = aLevel; + iAudioPlayer->SetVolume( ScaledVolume() ); + ret = PlayFeedback( aFeedback ); + iCurrentVolume = iOriginalVolume; + iAudioPlayer->SetVolume( ScaledVolume() ); + + TRACE("CTactileAudioPlayer::PlayPreviewFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::MaoscOpenComplete( TInt aError ) + { + if ( aError == KErrNone ) + { + iCurrentVolume = iVolumeLevels[0]; + iMaxRawVolume = iAudioPlayer->MaxVolume(); + iRepository.Get( KTactileFeedbackAudioVolume, iCurrentVolume ); + iAudioPlayer->SetVolume( ScaledVolume() ); + TRAP_IGNORE( iAudioPlayer->SetDataTypeL( KMMFFourCCCodePCM16 ) ); + iState = ETactileAudioReady; + } + else + { + TRACE2("CTactileAudioPlayer::MaoscOpenComplete( %d ) failed, will not play feedback", aError ); + delete iAudioPlayer; + iAudioPlayer = NULL; + + iState = ETactileAudioError; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::MaoscPlayComplete( TInt aError ) + { + TRACE("CTactileAudioPlayer::MaoscPlayComplete - Begin"); + iAudioPlayer->Stop(); + if ( aError == KErrCorrupt ) + { + TRACE2("CTactileAudioPlayer::MaoscPlayComplete( %d ) failed, will not play feedback", aError ); + delete iAudioPlayer; + iAudioPlayer = NULL; + + iState = ETactileAudioError; + } + else + { + iState = ETactileAudioReady; + } + TRACE("CTactileAudioPlayer::MaoscPlayComplete - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::MaoscBufferCopied( TInt aError, const TDesC8& /*aBuffer*/ ) + { + if ( !aError ) + { + iState = ETactileAudioReady; // may write another sample + } + else + { + TRACE2("CTactileAudioPlayer::MaoscPlayComplete( %d ) failed", aError); + } + } + +// --------------------------------------------------------------------------- +// Settings are now not read completely, as only the .wav -file of basic +// feedback is read, and same file is used for sensitive feedback. +// Using of separate files for basic and sensitive feedback +// can be added later in case necessary. +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::ReadSettingsL() + { + TRACE("CTactileAudioPlayer::ReadSettingsL - Begin"); + + iVolumeLevels.Reset(); + + delete iSensitiveFileName; + iSensitiveFileName = NULL; + + delete iBasicFileName; + iBasicFileName = NULL; + + iSensitiveFileName = HBufC::NewL( KMaxFileName ); + TPtr sensitiveFileName = iSensitiveFileName->Des(); + + iBasicFileName = HBufC::NewL( KMaxFileName ); + TPtr basicFileName = iBasicFileName->Des(); + + TInt basicVolumeLevel = 0; + TInt sensitiveVolumeLevel = 0; + + // Read volume values for level 2 + iRepository.Get( KTactileAudioWavVolumeBasicLevel2, basicVolumeLevel ); + + + iRepository.Get( KTactileAudioWavVolumeSensitiveLevel2, sensitiveVolumeLevel ); + + // Read file names + iRepository.Get( KTactileAudioWavFileBasicLevel2, basicFileName ); + + iRepository.Get( KTactileAudioWavFileSensitiveLevel2, sensitiveFileName ); + + iVolumeLevels.Append( basicVolumeLevel ); + iVolumeLevels.Append( sensitiveVolumeLevel ); + + TRACE("CTactileAudioPlayer::ReadSettingsL() - End"); + } + + +// --------------------------------------------------------------------------- +// ScaledVolume() +// return 100% scaled & sanity checked volume value +// --------------------------------------------------------------------------- +// +TInt CTactileAudioPlayer::ScaledVolume() + { + if ( iMaxRawVolume == KErrNotFound ) + { + TRACE( "CTactileAudioPlayer::ScaledVolume() Audio Hardware is not initialized properly" ); + return 0; + } + + TInt volume = iMaxRawVolume * iCurrentVolume / 100; + + if ( volume > iMaxRawVolume ) + { + // sanity check, we might get anything from cenrep + volume = iMaxRawVolume; + } + + TRACE4( "CTactileAudioPlayer::ScaledVolume() iCurrentVolume:%d scales volume to:%d out of iMaxRawVolume:%d", + iCurrentVolume, volume, iMaxRawVolume ); + + return volume; + } + +/* +* Wave file structure: Riff header + Wave format chunk + Wave data chunk +* +* Riff header: +* ================================================== +* Offset Size Description Value +* 0x00 4 Chunk ID "RIFF" +* 0x04 4 Chunk Data Size ( file size ) - 8 +* 0x08 4 RIFF Type "WAVE" +* 0x0c * Wave chunks * +* +* Wave Format Chunk: +* ================================================== +* Offset Size Description Value +* 0x00 4 Chunk ID "fmt " +* 0x04 4 Chunk Data Size 16 + extra format bytes ( 0 for normal wav files) +* 0x08 2 Compression code 1...65535 ( 1 for PCM uncompressed) +* 0x0a 2 Nbr of channels 1...65535 +* 0x0c 4 Sample rate 1...0xFFFFFFFF +* 0x10 4 Average bytes per sec +* 0x14 2 block align +* 0x16 2 siginificant bits per sample +* 0x18 2 extra format bytes 0...65535 +* 0x1a * extra format bytes, if any * +* +* Wave Data Chunk: +* ================================================== +* Offset Size Description Value +* 0x00 4 Chunk ID "data" +* 0x04 4 Chunk data size +* 0x08 * sample data * +* +*/ +void CTactileAudioPlayer::ReadSampleL( RFile& aFile, + HBufC8*& aDes, + TUint& aChannels, + TUint& aSampleRate ) + { + TRACE("CTactileAudioPlayer::ReadSampleL - Start"); + const TInt fmtOffset = 0x0c; + const TInt dataOffset = fmtOffset + 0x18; + + TBuf8 header; + TInt err = aFile.Read( header, KRiffHeaderSize ); + if ( err ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: reading from file failed, aborting"); + User::Leave( err ); + } + + TPtr8 p = header.LeftTPtr( 4 ); + + if ( p.Compare( KRiff ) ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: no RIFF header found, aborting" ); + User::Leave( KErrCorrupt ); + } + + p = header.MidTPtr( 0x08, 4 ); + if ( p.Compare( KWave ) ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: not a WAVE file, aborting" ); + User::Leave( KErrCorrupt ); + } + + p = header.MidTPtr( fmtOffset + 0x00, 4 ); + if ( p.Compare( KFmt ) ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: no 'fmt ' chunk found, aborting" ); + User::Leave( KErrCorrupt ); + } + + p = header.MidTPtr( dataOffset, 4 ); + if ( p.Compare( KData ) ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: no 'data' chunk found, aborting" ); + User::Leave( KErrCorrupt ); + } + + TUint8 lo = header[ fmtOffset + 0x08 ]; + TUint8 hi = header[ fmtOffset + 0x08 + 1 ]; + if ( !( lo == 1 && hi == 0) ) + { + TRACE("CTactileAudioPlayer::ReadSampleL: non PCM wav not supported, aborting" ); + User::Leave( KErrNotSupported ); + } + + lo = header[ fmtOffset + 0x0a ]; + hi = header[ fmtOffset + 0x0a + 1 ]; + aChannels = lo; + if ( !(aChannels == 1 || aChannels == 2 && hi == 0) ) + { + TRACE2("CTactileAudioPlayer::ReadSampleL: unsupported number of channels ( %d ), aborting", aChannels ); + User::Leave( KErrNotSupported ); + } + + aSampleRate = 0; + for ( TInt i = 0; i < 4; i++ ) + { + lo = header[ fmtOffset + 0x0c + i ]; + TUint32 tmp = lo; + tmp = tmp << i * 8; + + aSampleRate = aSampleRate | tmp; + } + + lo = header[ fmtOffset + 0x16 ]; + hi = header[ fmtOffset + 0x16 + 1 ]; + TUint16 bitsPerSample = hi; + bitsPerSample = bitsPerSample << 8; + bitsPerSample = bitsPerSample | lo; + + if ( bitsPerSample != 16 ) + { + TRACE2("CTactileAudioPlayer::ReadSampleL: %d bits per sample not supported", bitsPerSample ); + User::Leave( KErrNotSupported ); + } + + TUint32 bytesPerSample = bitsPerSample / 8; + + // how many bytes for 6 ms + TUint bytesNeeded = ( aSampleRate * aChannels * bytesPerSample * 6 ) / 1000; + + TInt fsize( 0 ); + if ( aFile.Size( fsize ) == KErrNone && fsize >= bytesNeeded + KRiffHeaderSize ) + { + aDes = HBufC8::NewL( bytesNeeded ); + TPtr8 des = aDes->Des(); + aFile.Read( des, bytesNeeded ); + } + else + { + TRACE("CTactileAudioPlayer::ReadSampleL: Less than 6ms content in file, aborting" ); + User::Leave( KErrNotSupported ); + } + + TRACE3("CTactileAudioPlayer::ReadSampleL %dHz %dchannel sample read successfully - End", + iSampleRate, iChannels); + } + +// --------------------------------------------------------------------------- +// Audio data reading from file and creation of the actual player utility. +// +// Rest of the initializations are done in MapcInitComplete -function. +// +// Notice that CMdaAudioOutputStream usage is not a good idea, as it +// buffers samples until buffer is full and flushes all in a row. Result is +// no feedback first, then a machine gun burst at some completely +// unrelated moment. +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::CreateWavPlayerL() + { + TRACE("CTactileAudioPlayer::CreateWavPlayerL - Start"); + iState = ETactileAudioInitialising; + delete iBasicSample; + iBasicSample = NULL; + delete iSensitiveSample; + iSensitiveSample = NULL; + + if ( !( iBasicFileName && iBasicFileName->Length() > 0 && + iSensitiveFileName && iSensitiveFileName->Length() > 0 )) + { + TRACE("CTactileAudioPlayer::CreateWavPlayerL filenames missing, aborting"); + User::Leave( KErrBadName ); + } + + RFs fs; + User::LeaveIfError ( fs.Connect() ); + CleanupClosePushL( fs ); + + RFile file; + TInt err = file.Open( fs, *iBasicFileName, EFileRead ); + if ( err ) + { + TRACE2("CTactileAudioPlayer::CreateWavPlayerL could not open %S, aborting", iBasicFileName ); + User::Leave( err ); + } + + CleanupClosePushL( file ); + ReadSampleL( file, iBasicSample, iChannels, iSampleRate ); + CleanupStack::PopAndDestroy(&file); + + RFile file2; + err = file2.Open( fs, *iSensitiveFileName, EFileRead ); + if ( err ) + { + TRACE2("CTactileAudioPlayer::CreateWavPlayerL could not open %S, aborting", iSensitiveFileName ); + User::Leave( err ); + } + + CleanupClosePushL( file2 ); + + TUint sampleRate(0); + TUint channels(0); + ReadSampleL( file2, iSensitiveSample, channels, sampleRate ); + CleanupStack::PopAndDestroy( &file2 ); + CleanupStack::PopAndDestroy( &fs ); + + if ( channels != iChannels || sampleRate != iSampleRate ) + { + TRACE("CTactileAudioPlayer::CreateWavPlayerL Sample rates and number of channels must be same for both files, aborting"); + User::Leave( KErrNotSupported ); + } + + TInt priority = KAudioPriorityKeyPressNonDTMFWithFeedback; + TMdaPriorityPreference pref = static_cast(KAudioPrefKeyPressNonDTMFWithFeedback); + + iAudioPlayer = CMdaAudioOutputStream::NewL( *this ,priority, pref); + + TMdaAudioDataSettings streamSettings; + switch ( iChannels ) + { + case 1: + streamSettings.iChannels = TMdaAudioDataSettings::EChannelsMono; + break; + case 2: + streamSettings.iChannels = TMdaAudioDataSettings::EChannelsStereo; + TRACE("CTactileAudioPlayer::CreateWavPlayerL Warning: stereo wav for feedback"); + break; + default: + TRACE2("CTactileAudioPlayer::CreateWavPlayerL: unsupported number of channels %d, aborting", iChannels ); + User::Leave( KErrNotSupported ); + break; + } + + // there must be easier way to do this... + switch( iSampleRate ) + { + case 48000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate48000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate48000Hz; + break; + case 44100: + TRACE2("CTactileAudioPlayer::CreateWavPlayerL: warning, samplerate %d causes performance problem", iSampleRate ); + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate44100Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate44100Hz; + break; + case 32000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate32000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate32000Hz; + break; + case 24000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate24000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate24000Hz; + break; + case 16000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate16000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate16000Hz; + break; + case 12000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate12000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate12000Hz; + break; + case 11025: + TRACE2("CTactileAudioPlayer::CreateWavPlayerL: warning, samplerate %d causes performance problem",iSampleRate ); + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate11025Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate11025Hz; + break; + case 8000: + streamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz; + streamSettings.iCaps = TMdaAudioDataSettings::ESampleRate8000Hz; + break; + default: + TRACE2("CTactileAudioPlayer::CreateWavPlayerL: unsupported samplerate %d, aborting",iSampleRate ); + User::Leave( KErrNotSupported ); + break; + } + + iAudioPlayer->Open( &streamSettings ); + + TRACE("CTactileAudioPlayer::CreateWavPlayerL - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileAudioPlayer::HandleNotifyInt( TUint32 aId, TInt aNewValue ) + { + TRACE("CTactileTonePlayer::HandleNotifyInt - Begin"); + if ( aId == KTactileFeedbackAudioVolume ) + { + iCurrentVolume = aNewValue; + iAudioPlayer->SetVolume( ScaledVolume() ); + } + TRACE("CTactileTonePlayer::HandleNotifyInt - End"); + } + + +//--------------------------------------------------------------------------- +// ImplementationTable[] +// +//--------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2002133A, CTactileAudioPlayer::NewL ) + }; + +//--------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// +//--------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + + + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_AUDIO_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_AUDIO_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/tactileaudioplayerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactileaudioplugin/traces/tactileaudioplayerTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILEAUDIOPLAYERTRACES_H__ +#define __TACTILEAUDIOPLAYERTRACES_H__ + +#define KOstTraceComponentID 0x20021339 + +#define TACTILE_PLAY_AUDIO_FEEDBACK_1 0x400001 +#define TACTILE_PLAY_AUDIO_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/data/2001CB98.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/data/2001CB98.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: ECom registration file for Tactile Haptics player plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2001CB98; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x2001CBA7; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001CB99; + version_no = 1; + display_name = ""; + default_data = "Haptics"; + opaque_data = ""; + } + }; + } + }; + } + +// End of file \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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 information file for tactile haptics plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// IBY file +../rom/tactilehapticsplugin.iby CORE_IBY_EXPORT_PATH(mw, tactilehapticsplugin.iby) + +PRJ_MMPFILES +tactilehapticsplugin.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/group/tactilehapticsplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/group/tactilehapticsplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Haptics Feedback player plugin. +* Part of: Tactile Feedback. +* +*/ + + + +#include +#include + +TARGET tactilehapticsplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001CB98 + +CAPABILITY CAP_ECOM_PLUGIN ReadDeviceData +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactilehapticsplayer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 2001CB98.rss +TARGETPATH ECOM_RESOURCE_DIR +TARGET tactilehapticsplugin.rsc +END + + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY hwrmhapticsclient.lib +LIBRARY tactilefeedbackresolver.lib +LIBRARY profileeng.lib diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/inc/tactilehapticsplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/inc/tactilehapticsplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing vibra feedback. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef C_TACTILEHAPTICSPLAYER_H +#define C_TACTILEHAPTICSPLAYER_H + + +#include +#include +#include +#include + +#include "tactileplayer.h" + +class CHWRMHaptics; + +class MProfileEngine; +class CProfileChangeNotifyHandler; +/** + * Class for procuding haptics feedback based on logical + * feedback type. + * + * @lib tactilehapticsplugin.lib + * @since S60 5.2 + */ + +NONSHARABLE_CLASS( CTactileHapticsPlayer ): public CTactilePlayer, + public MCenRepNotifyHandlerCallback, + public MProfileChangeObserver + { +public: + /** + * 2-phased constructor. + * @param aRepository - Reference to Central Repository. + * @return Instance of CTactileHapticsPlayers. + */ + static CTactileHapticsPlayer* NewL( CRepository& aRepository ); + + /** + * Destructor. + */ + virtual ~CTactileHapticsPlayer(); + + // from base class CTactilePlayer + + /** + * @see CTactilePlayer. + */ + TInt PlayFeedback( TTouchLogicalFeedback aFeedback ); + + /** + * @see CTactilePlayer. + */ + TInt StartFeedback( TTouchContinuousFeedback aFeedback, + TInt aIntensity ); + + /** + * @see CTactilePlayer. + */ + TInt ModifyFeedback( TInt aIntensity ); + + /** + * @see CTactilePlayer. + */ + void StopFeedback(); + + /** + * @see CTactilePlayer. + */ + TInt PlayPreviewFeedback( TInt aLevel, TTouchLogicalFeedback aFeedback ); + + /** + * @see CTactilePlayer. + */ + TInt StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity ); + + /** + * @see CTactilePlayer. + */ + void StopPreviewFeedback(); + +private: // From MCenRepNotifyHandlerCallback. + /** + * @see MCenRepNotifyHandlerCallback. + */ + void HandleNotifyGeneric( TUint32 aId ); + +private: // From MProfileChangeObserver + /** + * @see MProfileChangeObserver. + */ + void HandleActiveProfileEventL( TProfileEvent aProfileEvent, + TInt aProfileId ); + +private: + /** + * Plays haptics effect by logical feedback type. + * + */ + void DoPlayFeedbackL( TTouchLogicalFeedback aFeedback ); + + /** + * Reads IVT data from file to buffer. + * + */ + HBufC8* IVTBufAllocL( const TDesC& aFileName ); + + /** + * Get new settings value from Central Repository and + * change haptics property. + */ + void DoHandleNotifyGenericL( TUint32 aId ); + + /** + * Profiles engine -related initializations. + * (User changeable settings are stored in profiles) + */ + void InitializeProfilesEngineL(); + +private: + /** + * Constructor. + */ + CTactileHapticsPlayer( CRepository& aRepository ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + +private: // data + + /** + * Access to haptics functionality + * Own. + */ + CHWRMHaptics* iHaptics; + + /** + * Current effect handle. + */ + TInt iEffectHandle; + + /** + * Current effect index. + */ + TInt iEffectIndex; + + /** + * Handle to effect data file. + */ + TInt iIVTHandle; + + /** + * Multiplier, which is used for scaling the intenstiy of + * continuous feedback. + */ + TInt iMultiplier; + + /** + * Haptics effect strength. + */ + TInt iStrength; + + /** + * Access to settings. + * Not own. + */ + CRepository& iRepository; + + /** + * Utility for listening to changes in configurable parameters. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + + /** + * Access to user changeable settings (stored into profiles) + * Own. + */ + MProfileEngine* iProfileEng; + + /** + * For listening to changes in profiles. + * Own. + */ + CProfileChangeNotifyHandler* iProfileHandler; + }; + + +#endif // C_TACTILEHAPTICSPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/rom/tactilehapticsplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/rom/tactilehapticsplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: This is the IBY file for Tactile Haptics plugin. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILEHAPTICSPLUGIN_IBY +#define TACTILEHAPTICSPLUGIN_IBY + +#include + +ECOM_PLUGIN(tactilehapticsplugin.dll,tactilehapticsplugin.rsc) + +#endif // TACTILEHAPTICSPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/src/tactilehapticsplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/src/tactilehapticsplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,678 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing haptics feedback. +* Part of: Tactile Feedback. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbacktrace.h" + +#include "tactilehapticsplayer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactilehapticsplayerTraces.h" +#endif + +// ======== MEMBER FUNCTIONS ======== + +const TInt KMaxEffectNameLen = 128; + +// Pulse feedback's names +_LIT8( KTFBasic, "TFBasic"); +_LIT8( KTFSensitive, "TFSensitive"); +_LIT8( KTFBasicButton, "TFBasicButton"); +_LIT8( KTFSensitiveButton, "TFSensitiveButton"); +_LIT8( KTFList, "TFList"); +_LIT8( KTFSensitiveList, "TFSensitiveList"); +_LIT8( KTFBoundaryList, "TFBoundaryList"); +_LIT8( KTFSlider, "TFSlider"); +_LIT8( KTFEdit, "TFEdit"); +_LIT8( KTFLineSelection, "TFLineSelection"); +_LIT8( KTFBlankSelection, "TFBlankSelection"); +_LIT8( KTFTextSelection, "TFTextSelection"); +_LIT8( KTFEmptyLineSelection, "TFEmptyLineSelection"); +_LIT8( KTFTab, "TFTab"); +_LIT8( KTFPopUp, "TFPopUp"); +_LIT8( KTFIncreasingPopUp, "TFIncreasingPopUp"); +_LIT8( KTFDecreasingPopUp, "TFDecreasingPopUp"); +_LIT8( KTFFlick, "TFFlick"); +_LIT8( KTFCheckbox, "TFCheckbox"); +_LIT8( KTFSensitiveInput, "TFSensitiveInput"); +_LIT8( KTFCharacterInputButton, "TFCharacterInputButton"); +_LIT8( KTFMultiTouchRecognized, "TFMultiTouchRecognized"); + +// Continuous feedback's names +_LIT8( KTFContinuousSmooth, "TFContinuousSmooth"); +_LIT8( KTFContinuousSlider, "TFContinuousSlider"); +_LIT8( KTFContinuousInput, "TFContinuousInput"); +_LIT8( KTFContinuousFlick, "TFContinuousFlick"); +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactileHapticsPlayer::CTactileHapticsPlayer( CRepository& aRepository ) : + iRepository(aRepository) + { + + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::ConstructL() + { + TRACE("CTactileHapticsPlayer::ConstructL - Begin"); + iHaptics = CHWRMHaptics::NewL(NULL, NULL); + + TUint32 suppMask( 0 ); + User::LeaveIfError( iHaptics->SupportedActuators( suppMask ) ); + + TInt actuatorType( EHWRMLogicalActuatorAny ); + iRepository.Get( KTactileFeedbackHapticsActuator, actuatorType ); + + if ( actuatorType & suppMask ) + { + iHaptics->OpenActuatorL( static_cast(actuatorType) ); + } + + User::LeaveIfError( iHaptics->SetDeviceProperty( + CHWRMHaptics::EHWRMHapticsLicensekey, + KNullDesC8() ) ); + + TInt strength(0); + iRepository.Get( KTactileFeedbackHapticsStrength, strength ); + + // Strength value in settings is multiplied by 100 to scale value + // suitable for haptics (0-10000). + iStrength = strength * 100; + + // As a temporary fix to EAKH-7LKANT, the strength is (over)read from + // profiles engine + InitializeProfilesEngineL(); + + User::LeaveIfError( iHaptics->SetDeviceProperty( + CHWRMHaptics::EHWRMHapticsStrength, + iStrength ) ); + TFileName ivtFile; + iRepository.Get( KTactileHapticsIVTFile, ivtFile ); + HBufC8* ivtBuf = IVTBufAllocL( ivtFile ); + + CleanupStack::PushL( ivtBuf ); + User::LeaveIfError( iHaptics->LoadEffectData( *ivtBuf, iIVTHandle ) ); + CleanupStack::PopAndDestroy( ivtBuf ); + + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, + iRepository ); + iCenRepNotifier->StartListeningL(); + + TRACE("CTactileHapticsPlayer::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactileHapticsPlayer* CTactileHapticsPlayer::NewL( CRepository& aRepository ) + { + CTactileHapticsPlayer* self = + new ( ELeave ) CTactileHapticsPlayer( aRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileHapticsPlayer::~CTactileHapticsPlayer() + { + if( iProfileEng ) + { + iProfileEng->Release(); + iProfileEng = NULL; + } + delete iProfileHandler; + delete iCenRepNotifier; + delete iHaptics; + } + +// --------------------------------------------------------------------------- +// From class CTactilePlayer +// +// --------------------------------------------------------------------------- +// +TInt CTactileHapticsPlayer::PlayFeedback( TTouchLogicalFeedback aFeedback ) + { + // TRACE("CTactileHapticsPlayer::PlayFeedback - Start"); + + TRACE2("CTactileHapticsPlayer::PlayFeedback type: %d", aFeedback ); + TRAPD( err, DoPlayFeedbackL( aFeedback )); + if ( err != KErrNone ) + { + TRACE2("CTactileHapticsPlayer::PlayFeedback error: %d", err ); + } + + // TRACE("CTactileHapticsPlayer::PlayFeedback - End"); + return err; + } + +// --------------------------------------------------------------------------- +// Actually play feedback. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::DoPlayFeedbackL( TTouchLogicalFeedback aFeedback ) + { + // Check if hapticts strength is set to zero. + if ( !iStrength ) + { + User::Leave(KErrNotReady); + } + + TBuf8 name; + + switch( aFeedback ) + { + case ETouchFeedbackBasic: + name = KTFBasic; + break; + case ETouchFeedbackSensitive: + name = KTFSensitive; + break; + case ETouchFeedbackBasicButton: + name = KTFBasicButton; + break; + case ETouchFeedbackSensitiveButton: + name = KTFSensitiveButton; + break; + case ETouchFeedbackList: + name = KTFList; + break; + case ETouchFeedbackSensitiveList: + name = KTFSensitiveList; + break; + case ETouchFeedbackBoundaryList: + name = KTFBoundaryList; + break; + case ETouchFeedbackSlider: + name = KTFSlider; + break; + case ETouchFeedbackEdit: + name = KTFEdit; + break; + case ETouchFeedbackLineSelection: + name = KTFLineSelection; + break; + case ETouchFeedbackBlankSelection: + name = KTFBlankSelection; + break; + case ETouchFeedbackTextSelection: + name = KTFTextSelection; + break; + case ETouchFeedbackEmptyLineSelection: + name = KTFEmptyLineSelection; + break; + case ETouchFeedbackTab: + name = KTFTab; + break; + case ETouchFeedbackPopUp: + name = KTFPopUp; + break; + case ETouchFeedbackIncreasingPopUp: + name = KTFIncreasingPopUp; + break; + case ETouchFeedbackDecreasingPopUp: + name = KTFDecreasingPopUp; + break; + case ETouchFeedbackFlick: + name = KTFFlick; + break; + case ETouchFeedbackCheckbox: + name = KTFCheckbox; + break; + case ETouchFeedbackSensitiveInput: + name = KTFSensitiveInput; + break; + case ETouchFeedbackCharacterInputButton: + name = KTFCharacterInputButton; + break; + case ETouchFeedbackMultiTouchRecognized: + name = KTFMultiTouchRecognized; + break; + default: + User::Leave( KErrArgument ); + break; + } + TInt effectIndex(0); + User::LeaveIfError( iHaptics->GetEffectIndexFromName( iIVTHandle, + name, + effectIndex ) ); + TInt effectHandle(0); + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_HAPTICS_FEEDBACK_1, "e_TACTILE_PLAY_HAPTICS_FEEDBACK 1"); + User::LeaveIfError( iHaptics->PlayEffect( iIVTHandle, + effectIndex, + effectHandle ) ); + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_HAPTICS_FEEDBACK_0, "e_TACTILE_PLAY_HAPTICS_FEEDBACK 0"); + } + +// --------------------------------------------------------------------------- +// Load IVT file. +// --------------------------------------------------------------------------- +// +HBufC8* CTactileHapticsPlayer::IVTBufAllocL( const TDesC& aFileName ) + { + TRACE("CTactileHapticsPlayer::IVTBufAllocL - Begin"); + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + RFile file; + User::LeaveIfError( file.Open( fs, aFileName, EFileRead ) ); + CleanupClosePushL( file ); + + TInt fileSize( 0 ); + file.Size( fileSize ); + + HBufC8* ivtFileBuf = HBufC8::NewLC( fileSize ); + TPtr8 dataBufPtr = ivtFileBuf->Des(); + + User::LeaveIfError( file.Read( dataBufPtr ) ); + + CleanupStack::Pop( ivtFileBuf ); + CleanupStack::PopAndDestroy( &file ); + CleanupStack::PopAndDestroy( &fs ); + TRACE("CTactileHapticsPlayer::IVTBufAllocL - End"); + return ivtFileBuf; + } + +// --------------------------------------------------------------------------- +// Start feedback. +// --------------------------------------------------------------------------- +// +TInt CTactileHapticsPlayer::StartFeedback( TTouchContinuousFeedback aFeedback, + TInt aIntensity ) + { + TRACE("CTactileHapticsPlayer::StartFeedback - Start"); + TInt ret(KErrNone); + + // If there's an ongoing feedback, stop it first. + if ( iEffectHandle ) + { + StopFeedback(); + } + + TBuf8 name; + switch( aFeedback ) + { + case ETouchContinuousSmooth: + name = KTFContinuousSmooth; + break; + case ETouchContinuousSlider: + name = KTFContinuousSlider; + break; + case ETouchContinuousInput: + name = KTFContinuousInput; + break; + case ETouchContinuousFlick: + name = KTFContinuousFlick; + break; + default: + ret = KErrArgument; + break; + } + + if ( ret == KErrNone ) + { + ret = iHaptics->GetEffectIndexFromName( iIVTHandle, + name, + iEffectIndex ); + } + + TInt effectType(0); + if ( ret == KErrNone ) + { + ret = iHaptics->GetEffectType( iIVTHandle, + iEffectIndex, + effectType ); + } + + if ( ret == KErrNone ) + { + switch ( effectType ) + { + case CHWRMHaptics::EHWRMHapticsTypePeriodic: + { + CHWRMHaptics::THWRMHapticsPeriodicEffect periodicDef; + + ret = iHaptics->GetPeriodicEffectDefinition( iIVTHandle, + iEffectIndex, + periodicDef ); + + // Effect's magnitude value in IVT file is used as max value for + // continuous effects. + iMultiplier = periodicDef.iMagnitude / 100; + periodicDef.iMagnitude = aIntensity * iMultiplier; + + if ( ret == KErrNone ) + { + ret = iHaptics->PlayPeriodicEffect( periodicDef, + iEffectHandle ); + } + } + break; + case CHWRMHaptics::EHWRMHapticsTypeMagSweep: + { + CHWRMHaptics::THWRMHapticsMagSweepEffect magSweepDef; + + ret =iHaptics->GetMagSweepEffectDefinition( iIVTHandle, + iEffectIndex, + magSweepDef ); + + // Effect's magnitude value in IVT file is used as max value for + // continuous effects. + iMultiplier = magSweepDef.iMagnitude / 100; + magSweepDef.iMagnitude = aIntensity * iMultiplier; + + if ( ret == KErrNone ) + { + ret =iHaptics->PlayMagSweepEffect( magSweepDef, + iEffectHandle ); + } + } + break; + default: + TRACE("CTactileHapticsPlayer::StartFeedback - Playing effect not found"); + ret = KErrArgument; + break; + } + } + + TRACE("CTactileHapticsPlayer::StartFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// Modify feedback. +// --------------------------------------------------------------------------- +// +TInt CTactileHapticsPlayer::ModifyFeedback( TInt aIntensity ) + { + TRACE("CTactileHapticsPlayer::ModifyFeedback - Start"); + TInt ret(KErrNotReady); + + // Check if there's feedback started, do nothing if not. + if ( iEffectHandle ) + { + TInt effectType(0); + + ret = iHaptics->GetEffectType( iIVTHandle, + iEffectIndex, + effectType ); + + TRACE2("CTactileHapticsPlayer::ModifyFeedback - effect type %d", effectType ); + + if ( ret == KErrNone ) + { + TInt intensity = aIntensity * iMultiplier; + + switch ( effectType ) + { + case CHWRMHaptics::EHWRMHapticsTypePeriodic: + { + CHWRMHaptics::THWRMHapticsPeriodicEffect periodicDef; + + iHaptics->GetPeriodicEffectDefinition( iIVTHandle, + iEffectIndex, + periodicDef ); + + periodicDef.iMagnitude = intensity; + + iHaptics->ModifyPlayingPeriodicEffect( iEffectHandle, + periodicDef ); + } + break; + case CHWRMHaptics::EHWRMHapticsTypeMagSweep: + { + CHWRMHaptics::THWRMHapticsMagSweepEffect magSweepDef; + + iHaptics->GetMagSweepEffectDefinition( iIVTHandle, + iEffectIndex, + magSweepDef ); + + magSweepDef.iMagnitude = intensity; + + iHaptics->ModifyPlayingMagSweepEffect( iEffectHandle, + magSweepDef ); + + } + break; + default: + ret = KErrArgument; + break; + } + } + } + + TRACE("CTactileHapticsPlayer::ModifyFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// Stop feedback. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::StopFeedback() + { + TRACE("CTactileHapticsPlayer::StopFeedback - Start"); + iHaptics->StopAllPlayingEffects(); + iEffectHandle = 0; + TRACE("CTactileHapticsPlayer::StopFeedback - End"); + } + +// --------------------------------------------------------------------------- +// Check if there's a change in haptics settings and set new values if needed. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::DoHandleNotifyGenericL( TUint32 aId ) + { + TRACE("CTactileHapticsPlayer::DoHandleNotifyGenericL - Begin"); + switch ( aId ) + { + case KTactileFeedbackHapticsStrength: + { + // Strength value in settings is multiplied by 100 to scale value + // suitable for haptics. + TInt strength(0); + iRepository.Get( KTactileFeedbackHapticsStrength, strength ); + + iStrength = strength * 100; + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + iStrength ); + } + break; + case KTactileHapticsIVTFile: + { + TFileName ivtFile; + iRepository.Get( KTactileHapticsIVTFile, ivtFile ); + + HBufC8* ivtBuf = IVTBufAllocL( ivtFile ); + if ( ivtBuf ) + { + TInt ret = iHaptics->DeleteEffectData( iIVTHandle ); + if ( ret == KErrNone ) + { + iHaptics->LoadEffectData( *ivtBuf, iIVTHandle ); + } + delete ivtBuf; + } + } + break; + default: + break; + } + TRACE("CTactileHapticsPlayer::DoHandleNotifyGenericL - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTactileHapticsPlayer::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback ) + { + TRACE("CTactileHapticsPlayer::PlayPreviewFeedback - Begin"); + // Set preview level (scaled to haptics - multiplied by 100). + TInt ret = iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + aLevel * 100 ); + if ( ret == KErrNone ) + { + ret = PlayFeedback( aFeedback ); + } + + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + iStrength ); + + TRACE("CTactileHapticsPlayer::PlayPreviewFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTactileHapticsPlayer::StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity ) + { + TRACE("CTactileHapticsPlayer::StartPreviewFeedback - Begin"); + // Set preview level (scaled to haptics - multiplied by 100). + TInt ret = iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + aLevel * 100 ); + if ( ret == KErrNone ) + { + ret = StartFeedback( aFeedback, aIntensity ); + } + TRACE("CTactileHapticsPlayer::StartPreviewFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::StopPreviewFeedback() + { + TRACE("CTactileHapticsPlayer::StopPreviewFeedback - Begin"); + StopFeedback(); + + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, + iStrength ); + TRACE("CTactileHapticsPlayer::StopPreviewFeedback - Begin"); + } + +// --------------------------------------------------------------------------- +// From MCenRepNotifyHandlerCallback. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::HandleNotifyGeneric( TUint32 aId ) + { + TRACE("CTactileHapticsPlayer::HandleNotifyGeneric - Begin"); + TRAP_IGNORE( DoHandleNotifyGenericL( aId ) ); + TRACE("CTactileHapticsPlayer::HandleNotifyGeneric - End"); + } + +// --------------------------------------------------------------------------- +// From MProfileChangeObserver. +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::HandleActiveProfileEventL( + TProfileEvent /*aProfileEvent*/, + TInt /*aProfileId*/ ) + { + InitializeProfilesEngineL(); + iHaptics->SetDeviceProperty( CHWRMHaptics::EHWRMHapticsStrength, iStrength ); + } + +// --------------------------------------------------------------------------- +// Profiles engine -related initializations +// --------------------------------------------------------------------------- +// +void CTactileHapticsPlayer::InitializeProfilesEngineL() + { + // Create profiles engine, if it does not yet exist + if ( !iProfileEng ) + { + iProfileEng = CreateProfileEngineL(); + } + + MProfile* activeProfile = iProfileEng->ActiveProfileL(); + + const MProfileExtraSettings& extraSettings = + activeProfile->ProfileExtraSettings(); + + const MProfileFeedbackSettings& feedbackSettings = + extraSettings.ProfileFeedbackSettings(); + + TProfileTactileFeedback strength = feedbackSettings.TactileFeedback(); + iStrength = 100 * ( EProfileTactileFeedbackLevel3 == strength ? 100 : + EProfileTactileFeedbackLevel2 == strength ? 60 : + EProfileTactileFeedbackLevel1 == strength ? 30 : 0 ); + + activeProfile->Release(); + + // Create listener for profiles changes, if it does not yet exist + if ( !iProfileHandler ) + { + iProfileHandler = CProfileChangeNotifyHandler::NewL( this ); + } + } + +//--------------------------------------------------------------------------- +// ImplementationTable[] +// +//--------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001CB99, CTactileHapticsPlayer::NewL ) + }; + +//--------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// +//--------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_HAPTICS_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_HAPTICS_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/tactilehapticsplayerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/traces/tactilehapticsplayerTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILEHAPTICSPLAYERTRACES_H__ +#define __TACTILEHAPTICSPLAYERTRACES_H__ + +#define KOstTraceComponentID 0x2001cb98 + +#define TACTILE_PLAY_HAPTICS_FEEDBACK_1 0x400001 +#define TACTILE_PLAY_HAPTICS_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/data/2001CB9C.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/data/2001CB9C.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: ECom registration file for Tactile Audio Tone player plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2001CB9C; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x2001CBA7; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001CB9D; + version_no = 1; + display_name = ""; + default_data = "Audio"; + opaque_data = ""; + } + }; + } + }; + } + +// End of file \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ +/* +* 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 information file for tactile tone plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// IBY file +../rom/tactiletoneplugin.iby CORE_IBY_EXPORT_PATH(mw, tactiletoneplugin.iby) + +PRJ_MMPFILES +tactiletoneplugin.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/group/tactiletoneplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/group/tactiletoneplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Audio Tone Feedback player plugin. +* Part of: Tactile Feedback. +* +*/ + + + +#include +#include + +TARGET tactiletoneplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001CB9C + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactiletoneplayer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 2001CB9C.rss +TARGETPATH ECOM_RESOURCE_DIR +TARGET tactiletoneplugin.rsc +END + + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY mediaclientaudio.lib +LIBRARY tactilefeedbackresolver.lib +LIBRARY profileeng.lib diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/inc/tactiletoneplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/inc/tactiletoneplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for producing audio tone feedback. +* Part of: Tactile Feedback. +* +*/ + +#ifndef C_TACTILETONEPLAYER_H +#define C_TACTILETONEPLAYER_H + +#include +#include +#include +#include +#include + +#include "tactileplayer.h" + +class CRepository; +class MProfileEngine; +class CProfileChangeNotifyHandler; +/** + * Class for procuding audio tone feedback based on logical + * feedback type. + * + * @since S60 5.2 + */ +NONSHARABLE_CLASS( CTactileTonePlayer ): public CTactilePlayer, + public MMdaAudioToneObserver, + public MCenRepNotifyHandlerCallback, + public MProfileChangeObserver + { + /** + * Sound params for tone feedback. + */ + struct TTactileSoundParams + { + TInt iFrequency; + TTimeIntervalMicroSeconds iDuration; + TInt iVolume; // 0 = No physical feedback. + }; + + /** + * State of tone playing. + */ + enum TTactileToneState + { + ETactileTonePreparing, + ETactileToneReady, + ETactileTonePlaying, + ETactileTonePlayPending, + ETactileToneError + }; + +public: + + static CTactileTonePlayer* NewL( CRepository& aRepository ); + + + virtual ~CTactileTonePlayer(); + + // from base class CTactilePlayer + /** + * @see CTactilePlayer. + */ + TInt PlayFeedback( TTouchLogicalFeedback aFeedback ); + + /** + * @see CTactilePlayer. + */ + TInt PlayPreviewFeedback( TInt aLevel, TTouchLogicalFeedback aFeedback ); + +private: // From MMdaAudioToneObserver + + /** + * From MMdaAudioToneObserver + * Called when audio tone player utility has been configured. + * + * @param aError - KErrNone if operation was succesful. Otherwise one of + * the standard Symbian OS error codes. + */ + void MatoPrepareComplete( TInt aError ); + + /** + * From MMdaAudioToneObserver + * Called when audio tone playing operation has completed. + * + * @param aError - KErrNone if operation was succesful. Otherwise one of + * the standard Symbian OS error codes. + */ + void MatoPlayComplete( TInt aError ); + +private: // From MCenRepNotifyHandlerCallback. + + /** + * @see MCenRepNotifyHandlerCallback. + */ + void HandleNotifyInt( TUint32 aId, TInt aNewValue ); + +private: // From MProfileChangeObserver + /** + * @see MProfileChangeObserver. + */ + void HandleActiveProfileEventL( TProfileEvent aProfileEvent, + TInt aProfileId ); + +private: + /** + * Constructror. + */ + CTactileTonePlayer( CRepository& aRepository ); + + /** + * 2nd phase constructror. + */ + void ConstructL(); + + /** + * Read settings values. + */ + void ReadSettings(); + + /** + * Scales given volume percentage to 0 - CMdaAudioToneUtility::MaxVolume. + * + * @param aPercentages - Volume level in percentages + * @return Volume level that can be set to audio tone player. + */ + TInt ScaleVolume( TInt aPercentages ); + + /** + * Profiles engine -related initializations. + * (User changeable settings are stored in profiles) + */ + void InitializeProfilesEngineL(); + +private: // data + + /** + * Current state of the player. + */ + TTactileToneState iState; + + /** + * Audio tone player utility used for producing sound feedback. + * Own. + */ + CMdaAudioToneUtility* iMdaAudioToneUtility; + + /** + * Physical feedback definitions + */ + RArray iSoundParams; + + /** + * Currently loaded sound parameters (index is to iSoundParams array) + */ + TInt iCurrentEffectIndex; + + /** + * Reference to CenRep session + * Not own + */ + CRepository& iRepository; + + /** + * Utility for listening to changes in configurable parameters. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + /** + * Current audio volume level. + */ + TInt iAudioLevel; + + /** + * Original audio volume level is saved here in preview playing. + */ + TInt iOriginalLevel; + + /** + * This flag indicates if preview is played. This is needed because original + * settings have to be returned after preview. + */ + TBool iPlayPreview; + + /** + * Access to user changeable settings (stored into profiles) + * Own. + */ + MProfileEngine* iProfileEng; + + /** + * For listening to changes in profiles. + * Own. + */ + CProfileChangeNotifyHandler* iProfileHandler; + }; + + +#endif // C_TACTILETONEPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/rom/tactiletoneplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/rom/tactiletoneplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: This is the IBY file for Tactile Tone plugin. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILETONEPLUGIN_IBY +#define TACTILETONEPLUGIN_IBY + +#include + +ECOM_PLUGIN(tactiletoneplugin.dll,tactiletoneplugin.rsc) + +#endif // TACTILETONEPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/src/tactiletoneplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/src/tactiletoneplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,489 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for producing audio tone feedback. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbacktrace.h" + +#include "tactiletoneplayer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactiletoneplayerTraces.h" +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactileTonePlayer::CTactileTonePlayer( CRepository& aRepository ): + iRepository(aRepository) + { + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::ConstructL() + { + TRACE("CTactileTonePlayer::ConstructL - Begin"); + iMdaAudioToneUtility = CMdaAudioToneUtility::NewL( + *this, + NULL, + KAudioPriorityKeyPress, + TMdaPriorityPreference( KAudioPrefKeyPressNonDTMF ) ); + + User::LeaveIfError( iRepository.Get( KTactileFeedbackAudioVolume, + iAudioLevel ) ); + + // As a fix to EAKH-7LKANT, we're temporarily reading volume level + // settings from profiles engine + InitializeProfilesEngineL(); + + if ( iAudioLevel > EProfileAudioFeedbackLevel3 ) + { + User::Leave( KErrGeneral ); + } + + ReadSettings(); + + iMdaAudioToneUtility->PrepareToPlayTone( + iSoundParams[0].iFrequency, + iSoundParams[0].iDuration ); + + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, + iRepository, + CCenRepNotifyHandler::EIntKey, + KTactileFeedbackAudioVolume ); + iCenRepNotifier->StartListeningL(); + TRACE("CTactileTonePlayer::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactileTonePlayer* CTactileTonePlayer::NewL( CRepository& aRepository ) + { + TRACE("CTactileTonePlayer::NewL - Begin"); + CTactileTonePlayer* self = new ( ELeave ) CTactileTonePlayer(aRepository); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + TRACE("CTactileTonePlayer::NewL - End"); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileTonePlayer::~CTactileTonePlayer() + { + if( iProfileEng ) + { + iProfileEng->Release(); + iProfileEng = NULL; + } + delete iProfileHandler; + delete iCenRepNotifier; + delete iMdaAudioToneUtility; + iSoundParams.Close(); + } + + +// --------------------------------------------------------------------------- +// From class CTactilePlayer +// +// Here we first check if we are ready to play, and then either play +// sound immediately (if loaded parameters are correct), or then load +// the proper parameters in case this feedback type is different than +// the previously played one. +// --------------------------------------------------------------------------- +// +TInt CTactileTonePlayer::PlayFeedback( TTouchLogicalFeedback aFeedback ) + { + TRACE("CTactileTonePlayer::PlayFeedback- Begin"); + if ( iState == ETactileToneReady ) + { + TInt effectIndex(0); + + switch ( aFeedback ) + { + case ETouchFeedbackBasic: // flow through + case ETouchFeedbackBasicButton: // flow through + case ETouchFeedbackList: // flow through + case ETouchFeedbackBoundaryList: // flow through + case ETouchFeedbackSlider: // flow through + case ETouchFeedbackEdit: // flow through + case ETouchFeedbackSensitiveInput: + case ETouchFeedbackLineSelection: // flow through + case ETouchFeedbackBlankSelection: // flow through + case ETouchFeedbackTextSelection: // flow through + case ETouchFeedbackEmptyLineSelection: // flow through + case ETouchFeedbackTab: // flow through + case ETouchFeedbackPopUp: // flow through + case ETouchFeedbackIncreasingPopUp: // flow through + case ETouchFeedbackDecreasingPopUp: // flow through + case ETouchFeedbackFlick: // flow through + case ETouchFeedbackCheckbox: // flow through + case ETouchFeedbackCharacterInputButton: + case ETouchFeedbackMultiTouchRecognized: + effectIndex = 0; + break; + case ETouchFeedbackSensitive: // flow through + case ETouchFeedbackSensitiveButton: // flow through + case ETouchFeedbackSensitiveList: + effectIndex = 1; + break; + default: + effectIndex = 0; + break; + } + + // Check that we have valid effect index + if ( effectIndex < iSoundParams.Count() && + iAudioLevel != EProfileAudioFeedbackOff ) + { + if ( effectIndex == iCurrentEffectIndex ) + { + // Play the sound immediately. + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_AUDIO_TONE_FEEDBACK_1, "e_TACTILE_PLAY_AUDIO_TONE_FEEDBACK 1"); + + iMdaAudioToneUtility->Play(); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_AUDIO_TONE_FEEDBACK_0, "e_TACTILE_PLAY_AUDIO_TONE_FEEDBACK 0"); + + iState = ETactileTonePlaying; + } + else + { + // Load new parameters. + iMdaAudioToneUtility->PrepareToPlayTone( + iSoundParams[effectIndex].iFrequency, + iSoundParams[effectIndex].iDuration ); + + iCurrentEffectIndex = effectIndex; + + iState = ETactileTonePlayPending; + } + } + } + TRACE("CTactileTonePlayer::PlayFeedback- End"); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// +// +// --------------------------------------------------------------------------- +// +TInt CTactileTonePlayer::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback ) + { + TRACE("CTactileTonePlayer::PlayPreviewFeedback - Begin"); + TInt ret( KErrArgument ); + + if ( aLevel > EProfileAudioFeedbackOff && + aLevel <= EProfileAudioFeedbackLevel3 ) + { + iOriginalLevel = iAudioLevel; + iAudioLevel = aLevel; + ReadSettings(); + iCurrentEffectIndex = KErrNotFound; + iPlayPreview = ETrue; + ret = PlayFeedback( aFeedback ); + } + + TRACE("CTactileTonePlayer::PlayPreviewFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// From class MMdaAudioToneObserver. +// +// If initialization was succesfull, then we set the volume according +// to current effect, and after that either start to play (in case we +// have a pending play request), or just set ourselves to ready state. +// +// If initialization failed, then we set ourselves to error state. +// In practice this means that no sounds will be played at all. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::MatoPrepareComplete( TInt aError ) + { + if ( aError == KErrNone ) + { + if ( iCurrentEffectIndex < iSoundParams.Count() ) + { + iMdaAudioToneUtility->SetVolume( + iSoundParams[iCurrentEffectIndex].iVolume ); + } + if ( iState == ETactileTonePlayPending ) + { + iMdaAudioToneUtility->Play(); + + if ( iPlayPreview ) + { + iPlayPreview = EFalse; + iAudioLevel = iOriginalLevel; + ReadSettings(); + iCurrentEffectIndex = KErrNotFound; + } + iState = ETactileTonePlaying; + } + else + { + iState = ETactileToneReady; + } + } + else + { + iState = ETactileToneError; + } + } + + +// --------------------------------------------------------------------------- +// From class MMdaAudioToneObserver. +// +// Any errors are ignored, because they are most likely caused by +// override of higher priority client. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::MatoPlayComplete( TInt /*aError*/ ) + { + iState = ETactileToneReady; + } + + +// --------------------------------------------------------------------------- +// Read all audio configuration options (frequency, duration and volume) +// for each logical feedback into array according to current feedback level, +// so that they can conveniently be used when feedback needs to be played. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::ReadSettings() + { + TRACE("CTactileTonePlayer::ReadSettingsL- Begin"); + TTactileSoundParams basicParams; + basicParams.iFrequency = 0; + basicParams.iDuration = TTimeIntervalMicroSeconds( 0 ); + basicParams.iVolume = 0; + + TTactileSoundParams sensitiveParams = basicParams; + + TInt basicDuration = 0; + TInt sensitiveDuration = 0; + + if ( iAudioLevel == EProfileAudioFeedbackLevel1 ) + { + // Read settings for ETouchFeedbackBasic, level 1 + iRepository.Get( KTactileAudioToneFreqBasicLevel1, + basicParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationBasicLevel1, + basicDuration ); + iRepository.Get( KTactileAudioToneVolumeBasicLevel1, + basicParams.iVolume ); + + // Read settings for ETouchFeedbackSensitive, level 1 + iRepository.Get( KTactileAudioToneFreqSensitiveLevel1, + sensitiveParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationSensitiveLevel1, + sensitiveDuration ); + iRepository.Get( KTactileAudioToneVolumeSensitiveLevel1, + sensitiveParams.iVolume ); + } + else if ( iAudioLevel == EProfileAudioFeedbackLevel2 ) + { + // Read settings for ETouchFeedbackBasic, level 2 + iRepository.Get( KTactileAudioToneFreqBasicLevel2, + basicParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationBasicLevel2, + basicDuration ); + iRepository.Get( KTactileAudioToneVolumeBasicLevel2, + basicParams.iVolume ); + + // Read settings for ETouchFeedbackSensitive, level 2 + iRepository.Get( KTactileAudioToneFreqSensitiveLevel2, + sensitiveParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationSensitiveLevel2, + sensitiveDuration ); + iRepository.Get( KTactileAudioToneVolumeSensitiveLevel2, + sensitiveParams.iVolume ); + } + else if ( iAudioLevel == EProfileAudioFeedbackLevel3 ) + { + // Read settings for ETouchFeedbackBasic, level 3 + iRepository.Get( KTactileAudioToneFreqBasicLevel3, + basicParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationBasicLevel3, + basicDuration ); + iRepository.Get( KTactileAudioToneVolumeBasicLevel3, + basicParams.iVolume ); + + // Read settings for ETouchFeedbackSensitive, level 3 + iRepository.Get( KTactileAudioToneFreqSensitiveLevel3, + sensitiveParams.iFrequency ); + iRepository.Get( KTactileAudioToneDurationSensitiveLevel3, + sensitiveDuration ); + iRepository.Get( KTactileAudioToneVolumeSensitiveLevel3, + sensitiveParams.iVolume ); + } + + // Clear old parameters. Only do it at end, so that we still have the + // old settings in case something fails when reading these from + // Central Repository. + iSoundParams.Reset(); + + + // Duration is in milliseconds in central repository + // --> Convert to microseconds + basicParams.iDuration = + TTimeIntervalMicroSeconds( basicDuration * 1000 ); + sensitiveParams.iDuration = + TTimeIntervalMicroSeconds( sensitiveDuration * 1000 ); + + // Volume is in precentages in central repository + // --> Convert to 0-CMdaAudioToneUtility::MaxVolume + basicParams.iVolume = ScaleVolume( basicParams.iVolume ); + sensitiveParams.iVolume = ScaleVolume( sensitiveParams.iVolume ); + + // Store parameters for different feedback types + iSoundParams.Append( basicParams ); + iSoundParams.Append( sensitiveParams ); + TRACE("CTactileTonePlayer::ReadSettingsL - End"); + } + +// --------------------------------------------------------------------------- +// Scale the volume, and perform sanity check. +// --------------------------------------------------------------------------- +// +TInt CTactileTonePlayer::ScaleVolume( TInt aPercentages ) + { + TInt maxVolume = iMdaAudioToneUtility->MaxVolume(); + + TInt scaledVolume = ( maxVolume * aPercentages ) / 100; + + if ( scaledVolume > maxVolume ) + { + scaledVolume = maxVolume; + } + + return scaledVolume; + } + +// --------------------------------------------------------------------------- +// From MCenRepNotifyHandlerCallback. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::HandleNotifyInt( TUint32 aId, TInt aNewValue ) + { + TRACE("CTactileTonePlayer::HandleNotifyInt - Begin"); + if ( aId == KTactileFeedbackAudioVolume ) + { + iAudioLevel = aNewValue; + + // No need to read settings if audio feedback is set off. + if ( iAudioLevel != EProfileAudioFeedbackOff ) + { + ReadSettings(); + iCurrentEffectIndex = KErrNotFound; + } + } + TRACE("CTactileTonePlayer::HandleNotifyInt - End"); + } + +// --------------------------------------------------------------------------- +// From MProfileChangeObserver. +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::HandleActiveProfileEventL( + TProfileEvent /*aProfileEvent*/, + TInt /*aProfileId*/ ) + { + InitializeProfilesEngineL(); + ReadSettings(); + iCurrentEffectIndex = KErrNotFound; + } + +// --------------------------------------------------------------------------- +// Profiles engine -related initializations +// --------------------------------------------------------------------------- +// +void CTactileTonePlayer::InitializeProfilesEngineL() + { + // Create profiles engine, if it does not yet exist + if ( !iProfileEng ) + { + iProfileEng = CreateProfileEngineL(); + } + + MProfile* activeProfile = iProfileEng->ActiveProfileL(); + + const MProfileExtraSettings& extraSettings = + activeProfile->ProfileExtraSettings(); + + const MProfileFeedbackSettings& feedbackSettings = + extraSettings.ProfileFeedbackSettings(); + + iAudioLevel = feedbackSettings.AudioFeedback(); + + activeProfile->Release(); + + // Create listener for profiles changes, if it does not yet exist + if ( !iProfileHandler ) + { + iProfileHandler = CProfileChangeNotifyHandler::NewL( this ); + } + } + +//--------------------------------------------------------------------------- +// ImplementationTable[] +// +//--------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001CB9D, CTactileTonePlayer::NewL ) + }; + +//--------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// +//--------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_AUDIO_TONE_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_AUDIO_TONE_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/tactiletoneplayerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactiletoneplugin/traces/tactiletoneplayerTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILETONEPLAYERTRACES_H__ +#define __TACTILETONEPLAYERTRACES_H__ + +#define KOstTraceComponentID 0x2001cb9c + +#define TACTILE_PLAY_AUDIO_TONE_FEEDBACK_1 0x400001 +#define TACTILE_PLAY_AUDIO_TONE_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/data/2001CB9A.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/data/2001CB9A.rss Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,45 @@ +/* +* 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: ECom registration file for Tactile Legacy Vibra player plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2001CB9A; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x2001CBA7; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001CB9B; + version_no = 1; + display_name = ""; + default_data = "Haptics"; + opaque_data = ""; + } + }; + } + }; + } + +// End of file \ No newline at end of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/group/bld.inf Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for tactile vibra plugin. +* Part of: Tactile Feedback. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// IBY file +../rom/tactilevibraplugin.iby CORE_IBY_EXPORT_PATH(mw, tactilevibraplugin.iby) + + +PRJ_MMPFILES +tactilevibraplugin.mmp diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/group/tactilevibraplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/group/tactilevibraplugin.mmp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file for Legacy Vibra Feedback player plugin. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +TARGET tactilevibraplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x2001CB9A + +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE tactilevibraplayer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../../inc +USERINCLUDE ../traces + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data +START RESOURCE 2001CB9A.rss +TARGETPATH ECOM_RESOURCE_DIR +TARGET tactilevibraplugin.rsc +END + + +LIBRARY euser.lib +LIBRARY centralrepository.lib +LIBRARY cenrepnotifhandler.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY hwrmvibraclient.lib +LIBRARY tactilefeedbackresolver.lib diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/inc/tactilevibraplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/inc/tactilevibraplayer.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,166 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing vibra feedback. +* Part of: Tactile Feedback. +* +*/ + +#ifndef C_TACTILEVIBRAPLAYER_H +#define C_TACTILEVIBRAPLAYER_H + + +#include +#include +#include + +#include "tactileplayer.h" + +class CHWRMVibra; + +/** + * Class for procuding vibra feedback based on logical + * feedback type. + * + * @lib tactilevibraplugin.lib + * @since S60 5.2 + */ + +NONSHARABLE_CLASS( CTactileVibraPlayer ): public CTactilePlayer, + public MCenRepNotifyHandlerCallback + { +public: + /** + * Parameters of one vibrator effect + */ + struct TTactileVibraParams + { + TInt iTime; + TInt iIntensity; + }; + + /** + * 2-phased constructor. + * @param aRepository - Reference to Central Repository. + * @return Instance of CTactileVibraPlayer. + */ + static CTactileVibraPlayer* NewL( CRepository& aRepository ); + + /** + * Destructor. + */ + virtual ~CTactileVibraPlayer(); + + // from base class CTactilePlayer + + /** + * @see CTactilePlayer. + */ + TInt PlayFeedback( TTouchLogicalFeedback aFeedback ); + + /** + * @see CTactilePlayer. + */ + TInt StartFeedback( TTouchContinuousFeedback aFeedback, + TInt aIntensity ); + + /** + * @see CTactilePlayer. + */ + TInt ModifyFeedback( TInt aIntensity ); + + /** + * @see CTactilePlayer. + */ + void StopFeedback(); + + /** + * @see CTactilePlayer. + */ + TInt PlayPreviewFeedback( TInt aLevel, TTouchLogicalFeedback aFeedback ); + + +private: // From MCenRepNotifyHandlerCallback. + /** + * @see MCenRepNotifyHandlerCallback. + */ + void HandleNotifyInt( TUint32 aId, TInt aNewValue ); + +private: + /** + * Plays vibra effect by logical feedback type. + */ + void DoPlayFeedbackL( TInt aTime, TInt aIntensity ); + + /** + * Starts continuous vibra effect by logical feedback type. + */ + void DoStartFeedbackL( TTouchContinuousFeedback aType, + TInt aIntensity ); + /** + * Read settings values. + */ + void ReadSettings(); + +private: + /** + * Constructor. + */ + CTactileVibraPlayer( CRepository& aRepository ); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + +private: // data + + /** + * Array for storing vibrator parameters for each + * different physical feedback type. + */ + RArray iVibraParams; + + /** + * Access to vibra functionality + * Own. + */ + CHWRMVibra* iVibra; + + /** + * Access to settings. + * Not own. + */ + CRepository& iRepository; + + /** + * Utility for listening to changes in configurable parameters. + * Own. + */ + CCenRepNotifyHandler* iCenRepNotifier; + + /** + * Current vibra level. + */ + TInt iVibraLevel; + + /** + * Original vibra level is saved here when preview is played. + */ + TInt iOriginalLevel; + + }; + + +#endif // C_TACTILEVIBRAPLAYER_H diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/rom/tactilevibraplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/rom/tactilevibraplugin.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,27 @@ +/* +* 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: This is the IBY file for Tactile Vibra plugin. +* Part of: Tactile Feedback. +* +*/ + + +#ifndef TACTILEVIBRAPLUGIN_IBY +#define TACTILEVIBRAPLUGIN_IBY + +#include + +ECOM_PLUGIN(tactilevibraplugin.dll,tactilevibraplugin.rsc) + +#endif // TACTILEVIBRAPLUGIN_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/src/tactilevibraplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/src/tactilevibraplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,373 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for producing vibra feedback. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include +#include +#include + +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbacktrace.h" + +#include "tactilevibraplayer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactilevibraplayerTraces.h" +#endif + + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactileVibraPlayer::CTactileVibraPlayer( CRepository& aRepository ): + iRepository ( aRepository ) + { + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::ConstructL() + { + TRACE("CTactileVibraPlayer::ConstructL - Begin"); + + User::LeaveIfError( iRepository.Get( KTactileFeedbackHapticsStrength, + iVibraLevel ) ); + + if ( iVibraLevel > EProfileTactileFeedbackLevel3 ) + { + User::Leave( KErrGeneral ); + } + + ReadSettings(); + + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, + iRepository, + CCenRepNotifyHandler::EIntKey, + KTactileFeedbackHapticsStrength ); + iCenRepNotifier->StartListeningL(); + + TRACE("CTactileVibraPlayer::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactileVibraPlayer* CTactileVibraPlayer::NewL( CRepository& aRepository ) + { + CTactileVibraPlayer* self = + new ( ELeave ) CTactileVibraPlayer ( aRepository ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileVibraPlayer::~CTactileVibraPlayer() + { + delete iCenRepNotifier; + delete iVibra; + iVibraParams.Close(); + } + + +// --------------------------------------------------------------------------- +// From class CTactilePlayer +// +// Duration and intensity for the vibra are selected from the array +// according to logical feedback type. +// +// Feedback is not produced in case duration or intensity is zero. +// --------------------------------------------------------------------------- +// +TInt CTactileVibraPlayer::PlayFeedback( TTouchLogicalFeedback aFeedback ) + { + TInt ret(KErrNotReady); + if ( iVibraLevel != EProfileTactileFeedbackOff ) + { + TInt effectIndex = KErrNotFound; + + switch ( aFeedback ) + { + case ETouchFeedbackBasic: // flow through + case ETouchFeedbackBasicButton: // flow through + case ETouchFeedbackList: // flow through + case ETouchFeedbackBoundaryList: // flow through + case ETouchFeedbackSlider: // flow through + case ETouchFeedbackEdit: // flow through + case ETouchFeedbackSensitiveInput: + case ETouchFeedbackLineSelection: // flow through + case ETouchFeedbackBlankSelection: // flow through + case ETouchFeedbackTextSelection: // flow through + case ETouchFeedbackEmptyLineSelection: // flow through + case ETouchFeedbackTab: // flow through + case ETouchFeedbackPopUp: // flow through + case ETouchFeedbackIncreasingPopUp: // flow through + case ETouchFeedbackDecreasingPopUp: // flow through + case ETouchFeedbackFlick: // flow through + case ETouchFeedbackCheckbox: // flow through + case ETouchFeedbackCharacterInputButton: + case ETouchFeedbackMultiTouchRecognized: + effectIndex = 0; + break; + case ETouchFeedbackSensitive: // flow through + case ETouchFeedbackSensitiveButton: // flow through + case ETouchFeedbackSensitiveList: + effectIndex = 1; + break; + default: + effectIndex = 0; + break; + } + + if ( effectIndex < iVibraParams.Count() && + iVibraParams[effectIndex].iTime > 0 && + iVibraParams[effectIndex].iIntensity != 0) + { + TRACE2("CTactileVibraPlayer::PlayFeedback %d", aFeedback); + TRAP( ret, DoPlayFeedbackL( + iVibraParams[effectIndex].iTime, + iVibraParams[effectIndex].iIntensity ) ); + + if (!ret) + { + TRACE2("CTactileVibraPlayer: Vibra playing leave code: %d", ret); + } + } + } + return ret; + } + +// --------------------------------------------------------------------------- +// Start feedback. +// --------------------------------------------------------------------------- +// +TInt CTactileVibraPlayer::StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ) + { + TRACE("CTactileVibraPlayer::StartFeedback - Begin"); + TRAPD( ret, DoStartFeedbackL( aType, aIntensity ) ); + TRACE("CTactileVibraPlayer::StartFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// Modify feedback. +// --------------------------------------------------------------------------- +// +TInt CTactileVibraPlayer::ModifyFeedback( TInt /*aIntensity*/ ) + { + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// Stop feedback. +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::StopFeedback() + { + TRACE("CTactileVibraPlayer::StopFeedback - Begin"); + if ( iVibra ) + { + TRAP_IGNORE( iVibra->StopVibraL() ); + } + TRACE("CTactileVibraPlayer::StopFeedback - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +TInt CTactileVibraPlayer::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback ) + { + TRACE("CTactileVibraPlayer::PlayPreviewFeedback - Begin"); + TInt ret( KErrArgument ); + + if ( aLevel > EProfileTactileFeedbackOff && + aLevel <= EProfileTactileFeedbackLevel3 ) + { + iOriginalLevel = iVibraLevel; + iVibraLevel = aLevel; + ReadSettings(); + ret = PlayFeedback( aFeedback ); + iVibraLevel = iOriginalLevel; + ReadSettings(); + } + + TRACE("CTactileVibraPlayer::PlayPreviewFeedback - End"); + return ret; + } + +// --------------------------------------------------------------------------- +// Read vibra effects from central repository. +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::ReadSettings() + { + TRACE("CTactileVibraPlayer::ReadSettings - Begin"); + TTactileVibraParams basicParams; + + basicParams.iTime = 0; + basicParams.iIntensity = 0; + + TTactileVibraParams sensitiveParams = basicParams; + + if ( iVibraLevel == EProfileTactileFeedbackLevel1 ) + { + // Read settings for ETouchFeedbackBasic + iRepository.Get( KTactileVibraIntensityBasicLevel1, + basicParams.iIntensity ); + iRepository.Get( KTactileVibraDurationBasicLevel1, + basicParams.iTime ); + + // Read settings for ETouchFeedbackSensitive + iRepository.Get( KTactileVibraIntensitySensitiveLevel1, + sensitiveParams.iIntensity ); + iRepository.Get( KTactileVibraDurationSensitiveLevel1, + sensitiveParams.iTime ); + } + else if ( iVibraLevel == EProfileTactileFeedbackLevel2 ) + { + // Read settings for ETouchFeedbackBasic + iRepository.Get( KTactileVibraIntensityBasicLevel2, + basicParams.iIntensity ); + iRepository.Get( KTactileVibraDurationBasicLevel2, + basicParams.iTime ); + + // Read settings for ETouchFeedbackSensitive + iRepository.Get( KTactileVibraIntensitySensitiveLevel2, + sensitiveParams.iIntensity ); + iRepository.Get( KTactileVibraDurationSensitiveLevel2, + sensitiveParams.iTime ); + } + else if ( iVibraLevel == EProfileTactileFeedbackLevel3 ) + { + // Read settings for ETouchFeedbackBasic + iRepository.Get( KTactileVibraIntensityBasicLevel3, + basicParams.iIntensity ); + iRepository.Get( KTactileVibraDurationBasicLevel3, + basicParams.iTime ); + + // Read settings for ETouchFeedbackSensitive + iRepository.Get( KTactileVibraIntensitySensitiveLevel3, + sensitiveParams.iIntensity ); + iRepository.Get( KTactileVibraDurationSensitiveLevel3, + sensitiveParams.iTime ); + } + + iVibraParams.Reset(); + + iVibraParams.Append( basicParams ); + iVibraParams.Append( sensitiveParams ); + TRACE("CTactileVibraPlayer::ReadSettings - End"); + } + +// --------------------------------------------------------------------------- +// Actually play feedback. +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::DoPlayFeedbackL( TInt aTime, TInt aIntensity ) + { + TRACE("CTactileVibraPlayer::DoPlayFeedbackL - Begin"); + if ( !iVibra ) + { + // Construct iVibra at first feedback request. + iVibra = CHWRMVibra::NewL(); + } + + TRACE("CTactileVibraPlayer::DoPlayFeedbackL - Starting Vibra"); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_VIBRA_FEEDBACK_1, "e_TACTILE_PLAY_VIBRA_FEEDBACK 1"); + + iVibra->PulseVibraL( aTime, aIntensity ); + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_PLAY_VIBRA_FEEDBACK_0, "e_TACTILE_PLAY_VIBRA_FEEDBACK 0"); + TRACE("CTactileVibraPlayer::DoPlayFeedbackL - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::DoStartFeedbackL( TTouchContinuousFeedback /*aType*/, + TInt /*aIntensity*/ ) + { + if ( !iVibra ) + { + // Construct iVibra at first feedback request. + iVibra = CHWRMVibra::NewL(); + } + + if ( iVibraParams.Count() ) + { + TRACE2("CTactileVibraPlayer: StartVibraL Duration: %d", KHWRMVibraMaxDuration ); + TRACE2("CTactileVibraPlayer: StartVibraL Intensity: %d", iVibraParams[0].iIntensity ); + iVibra->StartVibraL( KHWRMVibraMaxDuration, + iVibraParams[0].iIntensity ); + } + } + +// --------------------------------------------------------------------------- +// From MCenRepNotifyHandlerCallback. +// --------------------------------------------------------------------------- +// +void CTactileVibraPlayer::HandleNotifyInt( TUint32 aId, TInt aNewValue ) + { + TRACE("CTactileVibraPlayer::HandleNotifyInt - Begin"); + if ( aId == KTactileFeedbackHapticsStrength ) + { + iVibraLevel = aNewValue; + if ( iVibraLevel != EProfileTactileFeedbackOff ) + { + ReadSettings(); + } + } + TRACE("CTactileVibraPlayer::HandleNotifyInt - End"); + } + +//--------------------------------------------------------------------------- +// ImplementationTable[] +// +//--------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY( 0x2001CB9B, CTactileVibraPlayer::NewL ) + }; + +//--------------------------------------------------------------------------- +// TImplementationProxy* ImplementationGroupProxy() +// +//--------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_VIBRA_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_PLAY_VIBRA_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/tactilevibraplayerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/plugins/tactilevibraplugin/traces/tactilevibraplayerTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILEVIBRAPLAYERTRACES_H__ +#define __TACTILEVIBRAPLAYERTRACES_H__ + +#define KOstTraceComponentID 0x2001cb9a + +#define TACTILE_PLAY_VIBRA_FEEDBACK_1 0x400001 +#define TACTILE_PLAY_VIBRA_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/rom/tactilefeedbackresolver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/rom/tactilefeedbackresolver.iby Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is the IBY file for Tactile Feedback Resolver. +* Part of: Tactile Feedback. +* +*/ + +#ifndef TACTILEFEEDBACKRESOLVER_IBY +#define TACTILEFEEDBACKRESOLVER_IBY + +#include + +// ============================================================================= +// Tactile Feedback Resolver +// ============================================================================= +file=ABI_DIR\BUILD_DIR\tactilefeedbackresolver.dll SHARED_LIB_DIR\tactilefeedbackresolver.dll + +// audio file(s) used for wav feed back +data=ZPRIVATE\10003B20\TactileFeedbackEffects.ivt private\10003B20\TactileFeedbackEffects.ivt + +#endif // TACTILEFEEDBACKRESOLVER_IBY diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactilefeedback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactilefeedback.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,403 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Client side of Tactile Feedback server. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include +#include + +#include + +#include "tactilefeedbacktrace.h" +#include "tactilefeedbacksrv.h" +#include "tactilefeedbackdefs.h" + +/** + * Own active scheduler class. We need this so that we can override the + * CActiveScheduler::Error -function and avoid panic in case something + * leaves. + */ +NONSHARABLE_CLASS( CTactileScheduler ): public CActiveScheduler + { +public: + + /** + * This is called when something leaves in our Feedback Player + * thread. + */ + void Error( TInt aError ) const; + }; + + +void CTactileScheduler::Error( TInt aError ) const + { + (void) aError; // Remove compiler warning in armv5 urel + + TRACE2( "CTactileScheduler::Error, aError = %d", aError ); + } + +/** + * Structure for the parameters, that are passed to Feedback Player Thread + * when it is created. + */ +struct TTactileThreadParams + { + RThread* iOwningThread; + TInt iQueueHandle; + }; + +/** + * Class for creating new thread for Tactile Feedback playing, and + * for passing feedback requests to the thread via a message queue. + */ +NONSHARABLE_CLASS( CThreadPlayer ): public CBase + { +public: + static CThreadPlayer* NewL(); + ~CThreadPlayer(); + +private: + CThreadPlayer() {}; + + void ConstructL(); + + static void RunThreadL( TAny* aParam ); + + static TInt ThreadEntryPoint( TAny* aParam ); + + RThread iThread; + }; + +// --------------------------------------------------------------------------- +// Here we create and start new thread for Tactile Feedback Playing. +// +// If this function returns succesfully, then the new thread was created ok +// and is now running. Otherwise we leave from here. +// +// --------------------------------------------------------------------------- +// +void CThreadPlayer::ConstructL() + { + TRACE("CThreadPlayer::ConstructL - Begin"); + + RThread thisThread; + + CleanupClosePushL( thisThread ); + + TTactileThreadParams params; + params.iOwningThread = &thisThread; + + User::LeaveIfError( + iThread.Create( + KTactileThreadName, + ThreadEntryPoint, + KPlayerThreadStackSize, + KPlayerThreadHeapMinSize, + KPlayerThreadHeapMaxSize, + ¶ms, + EOwnerProcess ) ); + + // With EPriorityMore feedback player thread operates with the same + // priority as window server main thread. This seems to be the best + // choice for now, as this way neither drawing or feedback can cause + // significant delay for each other. + iThread.SetPriority( EPriorityMore ); + iThread.Resume(); + + // We have to wait so that our thread has read the parameters + TRequestStatus status; + iThread.Rendezvous( status ); + User::WaitForRequest( status ); + + // Store thread exit type while we still have handles open + TExitType exitType = iThread.ExitType(); + + // Close thread handle to ourself. + CleanupStack::PopAndDestroy( &thisThread ); + + // Check that rendezvouz succeeded, and that thread is still alive + if ( exitType != EExitPending || status != KErrNone ) + { + TRACE3("CThreadPlayer::ConstructL - Thread creation failed, %d, %d", exitType, status.Int() ); + + User::Leave( KErrGeneral ); + } + + TRACE("CThreadPlayer::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +CThreadPlayer* CThreadPlayer::NewL() + { + CThreadPlayer* self = new( ELeave ) CThreadPlayer(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// We close our player thread by sending an exit request and waiting for +// the thread to close itself. This way all resources get closed cleanly. +// +// In case message queue is full, then we'll just kill the thread. +// --------------------------------------------------------------------------- +// +CThreadPlayer::~CThreadPlayer() + { + if ( iThread.Handle() ) + { + TExitType exitType = iThread.ExitType(); + + if ( exitType == EExitPending ) + { + iThread.Kill( KErrAbort ); + } + + iThread.Close(); + } + } + +// --------------------------------------------------------------------------- +// Rest of the actions required for setting Tactile Feedback Player thread +// up and running (this is called from ThreadEntryPoint) +// +// #1 Create and install an active scheduler +// #2 Create server instance. +// #3 Notify main thread that we are ready to run (this allows main thread +// to continue). +// #4 Start the scheduler. Excecution will halt here in this functio until +// somebody stops the scheduler. +// +// #5 Delete server and scheduler (at this point we are exiting our thread +// already). +// +// #6 Close ECom session, as we are now exiting the thread (this is on our +// responsibility even though we are not directly using Ecom). +// --------------------------------------------------------------------------- +// +void CThreadPlayer::RunThreadL( TAny* /*aParam*/ ) + { + // #1 + CTactileScheduler* s = new(ELeave) CTactileScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // #2 + CTactileFeedbackSrv* svr = CTactileFeedbackSrv::NewL(); + + // #3 + RThread me; + me.Rendezvous( KErrNone ); + + // #4 + CActiveScheduler::Start(); + + // #5 + delete svr; + CleanupStack::PopAndDestroy( s ); + + // #6 + REComSession::FinalClose(); + } + +// --------------------------------------------------------------------------- +// This is the entry point of Tactile feedback player thread. +// +// Standard operation: Create cleanup stack and call rest of the code under +// trap harness. +// --------------------------------------------------------------------------- +// +TInt CThreadPlayer::ThreadEntryPoint( TAny* aParam ) + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt err( KErrNoMemory ); + if ( cleanup ) + { + TRAP( err, CThreadPlayer::RunThreadL( aParam ) ); + delete cleanup; + } + __UHEAP_MARKEND; + return err; + } + +// -------------------------------------------------------------------------- +// Default constructor. +// +// -------------------------------------------------------------------------- +// +EXPORT_C RTactileFeedback::RTactileFeedback() + { + } + +// -------------------------------------------------------------------------- +// +// Creates connection to server +// -------------------------------------------------------------------------- +// +EXPORT_C TInt RTactileFeedback::Connect() + { + TInt ret = CreateSession( KTactileFeedbackServer, Version() ); + if ( ret != KErrNone ) + { + TRAP( ret, iThread = CThreadPlayer::NewL() ); + if ( ret == KErrNone ) + { + ret = CreateSession( KTactileFeedbackServer, Version() ); + } + } + + return ret; + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::Close() + { + delete iThread; + iThread = NULL; + // close session + RSessionBase::Close(); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::PlayFeedback( TTouchLogicalFeedback aFeedbackType, + TBool aPlayVibra, + TBool aPlayAudio ) + { + SendReceive( EPlayFeedback, TIpcArgs( aFeedbackType, + aPlayVibra, + aPlayAudio ) ); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ) + { + TRACE("RTactileFeedback::StartFeedback"); + SendReceive( EStartFeedback, TIpcArgs( aType, aIntensity ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::ModifyFeedback( TInt aIntensity ) + { + TRACE("RTactileFeedback::ModifyFeedback"); + SendReceive( EModifyFeedback, TIpcArgs( aIntensity ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::StopFeedback() + { + TRACE("RTactileFeedback::StopFeedback"); + SendReceive( EStopFeedback ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt RTactileFeedback::SetFeedbackEnabledForDevice( TTouchFeedbackType aFeedbackType ) + { + TRACE("RTactileFeedback::StopFeedback"); + return SendReceive( ESetFBEnabledDevice, TIpcArgs( aFeedbackType ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::FeedbackEnabledForDevice( TTouchFeedbackType& aFeedbackEnabled ) + { + TPckg enabled( aFeedbackEnabled ); + SendReceive( EFBEnabledForDevice, TIpcArgs( &enabled ) ); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ) + { + SendReceive( EPlayPreviewFeedback, TIpcArgs( aLevel, + aFeedback, + aType ) ); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ) + { + SendReceive( EStartPreviewFeedback, TIpcArgs( aLevel, aFeedback, + aIntensity, aType ) ); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::ModifyPreviewFeedback( TInt aIntensity ) + { + SendReceive( EModifyPreviewFeedback, TIpcArgs( aIntensity ) ); + } + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +EXPORT_C void RTactileFeedback::StopPreviewFeedback() + { + SendReceive( EStopPreviewFeedback ); + } + + +// -------------------------------------------------------------------------- +// +// -------------------------------------------------------------------------- +// +TVersion RTactileFeedback::Version() const + { + return TVersion( KTactileFeedbackServerMajor, + KTactileFeedbackServerMinor, + KTactileFeedbackServerBuild ); + } + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactilefeedbackresolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactilefeedbackresolver.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,520 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class for resolving physical feedback type based on +* tactile feedback settings and current device state. +* Part of: Tactile Feedback. +* +*/ + +#include +#include +#include + +#include +#include + +#include "tactilefeedbackprivatecrkeys.h" +#include "tactilefeedbackinternalpskeys.h" +#include "tactilefeedbacktrace.h" + +#include "tactilefeedbackresolver.h" +#include "tactilepropertywatcher.h" +#include "tactileplayer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "tactilefeedbackresolverTraces.h" +#endif + + +// Security policies for reading and writing to our P&S property +_LIT_SECURITY_POLICY_PASS( KTactileReadPolicy ); +_LIT_SECURITY_POLICY_C1( KTactileWritePolicy, ECapabilityWriteDeviceData ); +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Consructor. +// --------------------------------------------------------------------------- +// +CTactileFeedbackResolver::CTactileFeedbackResolver() : + iFeedbackStarted( EFalse ) + { + } + +// --------------------------------------------------------------------------- +// 2nd phase costructor. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::ConstructL() + { + TRACE("CTactileFeedbackResolver::ConstructL - Begin"); + + InitializeCrKeysL(); + + TInt hapticsUid(0); + TInt audioUid(0); + User::LeaveIfError( iRepository->Get( KTactileHapticsPlugin, hapticsUid ) ); + User::LeaveIfError( iRepository->Get( KTactileAudioPlugin, audioUid ) ); + + if ( hapticsUid ) + { + CreateHapticsPlayerL( TUid::Uid( hapticsUid ) ); + } + + if ( audioUid ) + { + CreateAudioPlayerL( TUid::Uid( audioUid ) ); + } + + InitializePsKeysL(); + + TRACE("CTactileFeedbackResolver::ConstructL - End"); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactileFeedbackResolver* CTactileFeedbackResolver::NewL() + { + CTactileFeedbackResolver* self = new ( ELeave ) CTactileFeedbackResolver; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactileFeedbackResolver::~CTactileFeedbackResolver() + { + delete iCenRepNotifier; + delete iRepository; + delete iPropertyWatcher; + delete iHapticsPlayer; + delete iAudioPlayer; + REComSession::FinalClose(); + } + +// --------------------------------------------------------------------------- +// We play feedback in case all three conditions are met: +// +// #1 Either vibra or audio feedback is requested and globally enabled +// #2 Given feedback type is different than "None" +// #3 Player instance exists +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::PlayFeedback( + TTouchLogicalFeedback aFeedback, + TBool aPlayVibra, + TBool aPlayAudio ) + { + // TRACE("CTactileFeedbackResolver::PlayFeedback - Begin"); + // Feedback filtering in order to prevent too many feedbacks + // in a short time (e.g. when doing text selection). + TTime now; + now.UniversalTime(); + + TTimeIntervalMicroSeconds interval = + now.MicroSecondsFrom( iLastFeedbackTimeStamp ); + + if ( iMinimumInterval == TTimeIntervalMicroSeconds( 0 ) || + now < iLastFeedbackTimeStamp || + iMinimumInterval <= interval ) + { + // First store the timestamp of this feedback playing moment. + // This really needs to be done when + // actually playing feedback (not when feedback was requested + // but filtered out). + iLastFeedbackTimeStamp = now; + + + // Force vibra- and audio feedback off if those are globally disabled + if ( !iVibraEnabled ) + { + aPlayVibra = EFalse; + } + + if ( !iAudioEnabled ) + { + aPlayAudio = EFalse; + } + + if ( ( aPlayVibra || aPlayAudio ) && // #1 + aFeedback != ETouchFeedbackNone ) // #2 + { + OstTrace0( TACTILE_PERFORMANCE, TACTILE_RESOLVER_PLAY_FEEDBACK_1, "e_TACTILE_RESOLVER_PLAY_FEEDBACK 1"); + + if ( iVibraFirst ) + { + if ( aPlayVibra && iHapticsPlayer ) + { + iHapticsPlayer->PlayFeedback( aFeedback ); + } + if ( aPlayAudio && iAudioPlayer ) + { + iAudioPlayer->PlayFeedback( aFeedback ); + } + } + else + { + if ( aPlayAudio && iAudioPlayer ) + { + iAudioPlayer->PlayFeedback( aFeedback ); + } + if ( aPlayVibra && iHapticsPlayer ) + { + iHapticsPlayer->PlayFeedback( aFeedback ); + } + } + + OstTrace0( TACTILE_PERFORMANCE, TACTILE_RESOLVER_PLAY_FEEDBACK_0, "e_TACTILE_RESOLVER_PLAY_FEEDBACK 0"); + } + } + // TRACE("CTactileFeedbackResolver::PlayFeedback - End"); + } + +// --------------------------------------------------------------------------- +// Central Repository related initializations. +// +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::InitializeCrKeysL() + { + if ( !iRepository ) + { + iRepository = CRepository::NewL( KCRUidTactileFeedback ); + } + + TInt minInterval(0); + // Read and store minimun feedback interfal + User::LeaveIfError( iRepository->Get( KTactileFeedbackMinimumInterval, + minInterval ) ); + + // Time is in milliseconds in Central Repository + iMinimumInterval = TTimeIntervalMicroSeconds( 1000*minInterval ); + + + TInt internalSettings(0); + + User::LeaveIfError( iRepository->Get( KTactileInternalSettings, + internalSettings ) ); + + iVibraFirst = internalSettings & KTactileInternalSettingsVibraPlayedFirst; + + // Notifier for Central Repository changes. + if ( !iCenRepNotifier ) + { + iCenRepNotifier = CCenRepNotifyHandler::NewL( *this, + *iRepository ); + iCenRepNotifier->StartListeningL(); + } + } + +// --------------------------------------------------------------------------- +// P&S -related initializations have been moved here for making +// ConstructL more clear. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::InitializePsKeysL() + { + TInt err = RProperty::Define( + KPSUidTactileFeedback, + KTactileFeedbackEnabled, + RProperty::EInt, + KTactileReadPolicy, + KTactileWritePolicy ); + + if ( err != KErrNone && err != KErrAlreadyExists ) + { + User::Leave( err ); + } + + // Enable feedback by default. + TInt playerType(0); + playerType |= ETouchFeedbackVibra; + playerType |= ETouchFeedbackAudio; + + RProperty::Set( KPSUidTactileFeedback, KTactileFeedbackEnabled, playerType ); + + // Watcher will start monitoring immediately, i.e. we don't have to + // start it separately. + iPropertyWatcher = CTactilePropertyWatcher::NewL( + *this, + KPSUidTactileFeedback, + KTactileFeedbackEnabled, + CActive::EPriorityStandard ); + + ReadFeedbackEnabledFromPS(); + } + +// --------------------------------------------------------------------------- +// We only change our bookkeeping in case we succeed in reading the P&S +// property +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::ReadFeedbackEnabledFromPS() + { + TInt tmpVal = 0; + TInt err = iPropertyWatcher->Get( tmpVal ); + + if ( err == KErrNone ) + { + iVibraEnabled = EFalse; + iAudioEnabled = EFalse; + + // Check if vibra feedback is enabled (bit 0x01). + if ( (tmpVal & 0x01) ) + { + iVibraEnabled = ETrue; + } + // Check if audio feedback is enabled (bit 0x02). + if ( (tmpVal & 0x02) ) + { + iAudioEnabled = ETrue; + } + } + } + +// --------------------------------------------------------------------------- +// From class MTactilePropertyObserver +// Called when the property for globally enabling or disabling feedback +// changes +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::PropertyChangedL( const TUid aCategory, + const TUint aKey ) + { + if ( aCategory == KPSUidTactileFeedback && + aKey == KTactileFeedbackEnabled ) + { + ReadFeedbackEnabledFromPS(); + } + } + +// --------------------------------------------------------------------------- +// Start continuous feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ) + { + if ( iHapticsPlayer && !iFeedbackStarted && iVibraEnabled ) + { + iHapticsPlayer->StartFeedback( aType, aIntensity ); + iFeedbackStarted = ETrue; + } + } + +// --------------------------------------------------------------------------- +// Modify continuous feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::ModifyFeedback( TInt aIntensity ) + { + if ( iHapticsPlayer ) + { + iHapticsPlayer->ModifyFeedback( aIntensity ); + } + } + +// --------------------------------------------------------------------------- +// Stop continuous feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::StopFeedback() + { + if ( iHapticsPlayer ) + { + iHapticsPlayer->StopFeedback(); + iFeedbackStarted = EFalse; + } + } + +// --------------------------------------------------------------------------- +// Play preview feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ) + { + if ( aType & ETouchFeedbackVibra && iHapticsPlayer ) + { + iHapticsPlayer->PlayPreviewFeedback( aLevel, aFeedback ); + } + if ( aType & ETouchFeedbackAudio && iAudioPlayer ) + { + iAudioPlayer->PlayPreviewFeedback( aLevel, aFeedback ); + } + } + +// --------------------------------------------------------------------------- +// Start preview of continuous feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ) + { + if ( aType & ETouchFeedbackVibra && iHapticsPlayer ) + { + iHapticsPlayer->StartPreviewFeedback( aLevel, aFeedback, aIntensity ); + } + } + +// --------------------------------------------------------------------------- +// Stop preview of continuous feedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::StopPreviewFeedback() + { + if ( iHapticsPlayer ) + { + iHapticsPlayer->StopPreviewFeedback(); + } + } + +// --------------------------------------------------------------------------- +// Create haptics player. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::CreateHapticsPlayerL( TUid aHapticsUid ) + { + RImplInfoPtrArray implArray; + CleanupClosePushL( implArray ); + CTactilePlayer::ListImplementationsL( ETactilePlayerHaptics, implArray ); + + if (!implArray.Count()) + { + TRACE( "CTactileFeedbackResolver::ConstructL - No Haptics plugins found" ); + } + for ( TInt i(0) ; i < implArray.Count() && !iHapticsPlayer; i++ ) + { + // Create haptics player. + if ( !iHapticsPlayer && + ( implArray[i]->ImplementationUid() == aHapticsUid ) ) + { + TUid pluginUid = implArray[i]->ImplementationUid(); + + // delete implementation info list contents + implArray.ResetAndDestroy(); + + iHapticsPlayer = CTactilePlayer::NewL( pluginUid, *iRepository ); + } + } + + // Make sure that implArray is reseted also if plugin wasn't found. + if ( !iHapticsPlayer ) + { + implArray.ResetAndDestroy(); + } + + CleanupStack::PopAndDestroy( &implArray ); + } + +// --------------------------------------------------------------------------- +// Create audio player. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::CreateAudioPlayerL( TUid aAudioUid ) + { + RImplInfoPtrArray implArray; + CleanupClosePushL( implArray ); + CTactilePlayer::ListImplementationsL( ETactilePlayerAudio, implArray ); + + if (!implArray.Count()) + { + TRACE( "CTactileFeedbackResolver::ConstructL - No Audio plugins found" ); + } + for ( TInt i(0) ; i < implArray.Count() && !iAudioPlayer; i++ ) + { + // Create audio player. + if ( !iAudioPlayer && + ( implArray[i]->ImplementationUid() == aAudioUid ) ) + { + TUid pluginUid = implArray[i]->ImplementationUid(); + + // delete implementation info list contents + implArray.ResetAndDestroy(); + + iAudioPlayer = CTactilePlayer::NewL( pluginUid, *iRepository ); + } + } + + // Make sure that implArray is reseted also if plugin wasn't found. + if ( !iAudioPlayer ) + { + implArray.ResetAndDestroy(); + } + + CleanupStack::PopAndDestroy( &implArray ); + } + +// --------------------------------------------------------------------------- +// From MCenRepNotifyHandlerCallback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::HandleNotifyGeneric( TUint32 aId ) + { + TRAP_IGNORE( DoHandleNotifyGenericL(aId ) ); + } + +// --------------------------------------------------------------------------- +// Handle changes in tactile feedback settings. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackResolver::DoHandleNotifyGenericL( TUint32 aId ) + { + switch ( aId ) + { + case KTactileFeedbackMinimumInterval: + InitializeCrKeysL(); + break; + case KTactileHapticsPlugin: + { + TInt hapticsUid(0); + iRepository->Get( KTactileHapticsPlugin, hapticsUid ); + if ( iHapticsPlayer ) + { + delete iHapticsPlayer; + iHapticsPlayer = NULL; + } + if ( hapticsUid ) + { + CreateHapticsPlayerL( TUid::Uid( hapticsUid ) ); + } + } + break; + case KTactileAudioPlugin: + { + TInt audioUid(0); + iRepository->Get( KTactileAudioPlugin, audioUid ); + if ( iAudioPlayer ) + { + delete iAudioPlayer; + iAudioPlayer = NULL; + } + if ( audioUid ) + { + CreateAudioPlayerL( TUid::Uid( audioUid ) ); + } + } + break; + default: + break; + } + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactilefeedbacksession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactilefeedbacksession.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,277 @@ +/* +* 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: Session class of Tactile Feedback server. +* Part of: Tactile Feedback. +* +*/ + +#include + +// #include "tactilefeedbacktrace.h" +#include "tactilefeedbacksrv.h" +#include "tactilefeedbacksession.h" + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::CTactileFeedbackSession +// C++ constructor. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSession::CTactileFeedbackSession() + { + + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::~CTactileFeedbackSession +// C++ destructor. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSession::~CTactileFeedbackSession() + { + // Stop continuous feedback, if it is started in this session. + if ( iFeedbackStarted ) + { + Server().StopFeedback(); + } + Server().RemoveSession(); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::CreateL +// From CSession2, used to increase server's session count. +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::CreateL() + { + // TRACE("CTactileFeedbackSession::CreateL - Begin"); + Server().AddSession(); + // TRACE("CTactileFeedbackSession::CreateL - End"); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::Server +// Reference to server. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSrv& CTactileFeedbackSession::Server() + { + return *static_cast + ( const_cast( CSession2::Server() ) ); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::ServiceL +// From CSession2, passes the request forward to DispatchMessageL. +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::ServiceL( const RMessage2& aMessage ) + { + TRAPD(err,DispatchMessageL(aMessage)); + if ( err != KErrNone ) + { + aMessage.Complete( err ); + } + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::DispatchMessageL +// Handles the request from client. +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::DispatchMessageL( const RMessage2& aMessage ) + { + switch( aMessage.Function() ) + { + case EPlayFeedback: + PlayFeedback( aMessage ); + break; + case EStartFeedback: + StartFeedback( aMessage ); + break; + case EModifyFeedback: + ModifyFeedback( aMessage ); + break; + case EStopFeedback: + StopFeedback( aMessage ); + break; + case ESetFBEnabledDevice: + SetFBEnabledForDeviceL( aMessage ); + break; + case EFBEnabledForDevice: + FeedbackEnabledForDeviceL( aMessage ); + break; + case EPlayPreviewFeedback: + PlayPreviewFeedback( aMessage ); + break; + case EStartPreviewFeedback: + StartPreviewFeedback( aMessage ); + break; + case EModifyPreviewFeedback: + ModifyPreviewFeedback( aMessage ); + break; + case EStopPreviewFeedback: + StopPreviewFeedback( aMessage ); + break; + default: + aMessage.Complete( KErrArgument ); + break; + } + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::PlayFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::PlayFeedback( const RMessage2& aMessage ) + { + Server().PlayFeedback( static_cast(aMessage.Int0()), + aMessage.Int1(), + aMessage.Int2() ); + + aMessage.Complete( KErrNone ); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::StartFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::StartFeedback( const RMessage2& aMessage ) + { + // TRACE("CTactileFeedbackSession::StartFeedbackL - Begin"); + Server().StartFeedback( + static_cast( aMessage.Int0() ), + aMessage.Int1() ); + iFeedbackStarted = ETrue; + aMessage.Complete( KErrNone ); + // TRACE("CTactileFeedbackSession::StartFeedbackL - End"); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::ModifyFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::ModifyFeedback( const RMessage2& aMessage ) + { + // TRACE("CTactileFeedbackSession::ModifyFeedbackL - Begin"); + Server().ModifyFeedback( aMessage.Int0() ); + aMessage.Complete( KErrNone ); + // TRACE("CTactileFeedbackSession::ModifyFeedbackL - End"); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::StopFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::StopFeedback( const RMessage2& aMessage ) + { + // TRACE("CTactileFeedbackSession::StopFeedbackL - Begin"); + Server().StopFeedback(); + iFeedbackStarted = EFalse; + aMessage.Complete( KErrNone ); + // TRACE("CTactileFeedbackSession::StopFeedbackL - End"); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::SetFBEnabledForDeviceL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::SetFBEnabledForDeviceL( const RMessage2& aMessage ) + { + if ( aMessage.HasCapability( ECapabilityWriteDeviceData ) ) + { + Server().EnableFeedbackForDevice( + static_cast( aMessage.Int0() ) ); + aMessage.Complete( KErrNone ); + } + else + { + User::Leave( KErrPermissionDenied ); + } + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::FeedbackEnabledForDeviceL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::FeedbackEnabledForDeviceL( const RMessage2& aMessage ) + { + TTouchFeedbackType feedbackEnabled = Server().FeedbackEnabledForDevice(); + + TPckg enabled(feedbackEnabled); + + aMessage.WriteL( 0, enabled ); + aMessage.Complete( KErrNone ); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::PlayPreviewFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::PlayPreviewFeedback( const RMessage2& aMessage ) + { + Server().PlayPreviewFeedback( aMessage.Int0(), + static_cast(aMessage.Int1() ), + static_cast(aMessage.Int2() ) ); + aMessage.Complete( KErrNone ); + + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::StartPreviewFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::StartPreviewFeedback( const RMessage2& aMessage ) + { + Server().StartPreviewFeedback( + aMessage.Int0(), + static_cast( aMessage.Int1() ), + aMessage.Int2(), + static_cast( aMessage.Int3() ) ); + iFeedbackStarted = ETrue; + aMessage.Complete( KErrNone ); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::ModifyPreviewFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::ModifyPreviewFeedback( const RMessage2& aMessage ) + { + // Normal ModifyFeedback function is used also for preview. + Server().ModifyFeedback( aMessage.Int0() ); + aMessage.Complete( KErrNone ); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSession::StopPreviewFeedbackL +// +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSession::StopPreviewFeedback( const RMessage2& aMessage ) + { + Server().StopPreviewFeedback(); + iFeedbackStarted = EFalse; + aMessage.Complete( KErrNone ); + } + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactilefeedbacksrv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactilefeedbacksrv.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,223 @@ +/* +* 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: Tactile feedback server implementation. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +#include "tactilefeedbacksrv.h" +#include "tactilefeedbacksession.h" + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::NewLC +// 2-phased constructor. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSrv* CTactileFeedbackSrv::NewL() + { + CTactileFeedbackSrv* self = new (ELeave) CTactileFeedbackSrv(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::CTactileFeedbackSrv() +// C++ constructor. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSrv::CTactileFeedbackSrv() + : CPolicyServer( EPriorityNormal, + KTactileFeedbackPolicy, + ESharableSessions ), + iSessionCount(0) + { + // Vibra and audio feedbacks are enabled by default. + iDeviceFeedbackEnabled |= ETouchFeedbackAudio; + iDeviceFeedbackEnabled |= ETouchFeedbackVibra; + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::ConstructL +// 2nd phase constructor. +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::ConstructL() + { + StartL( KTactileFeedbackServer ); + iResolver = CTactileFeedbackResolver::NewL(); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::~CTactileFeedbackSrv() +// C++ destructor. +// -------------------------------------------------------------------------- +// +CTactileFeedbackSrv::~CTactileFeedbackSrv() + { + delete iResolver; + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::NewSessionL +// from CServer2, creates a new session. +// -------------------------------------------------------------------------- +// +CSession2* CTactileFeedbackSrv::NewSessionL( const TVersion& aVersion, + const RMessage2& /*aMsg*/ ) const + { + TBool supported = User::QueryVersionSupported( TVersion( + KTactileFeedbackServerMajor, + KTactileFeedbackServerMinor, + KTactileFeedbackServerBuild ), + aVersion ); + if ( !supported ) + { + User::Leave( KErrNotSupported ); + } + + return new (ELeave) CTactileFeedbackSession(); + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::AddSession +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::AddSession() + { + iSessionCount++; + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::RemoveSession +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::RemoveSession() + { + iSessionCount--; + if ( !iSessionCount ) + { + CActiveScheduler::Stop(); + } + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::PlayFeedback +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::PlayFeedback( TTouchLogicalFeedback aFeedback, + TBool aPlayHaptics, + TBool aPlayAudio ) + { + TBool playHaptics(EFalse); + TBool playAudio(EFalse); + + if ( (iDeviceFeedbackEnabled & ETouchFeedbackVibra) && aPlayHaptics ) + { + playHaptics = ETrue; + } + if ( (iDeviceFeedbackEnabled & ETouchFeedbackAudio) && aPlayAudio ) + { + playAudio = ETrue; + } + + if ( playHaptics || playAudio ) + { + iResolver->PlayFeedback( aFeedback, playHaptics, playAudio ); + } + } + +// -------------------------------------------------------------------------- +// CTactileFeedbackSrv::StartFeedback +// -------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::StartFeedback( TTouchContinuousFeedback aType, + TInt aIntensity ) + { + iResolver->StartFeedback( aType, aIntensity ); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::ModifyFeedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::ModifyFeedback( TInt aIntensity ) + { + iResolver->ModifyFeedback( aIntensity ); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::StopFeedback. +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::StopFeedback() + { + iResolver->StopFeedback(); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::EnableFeedbackForDevice +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::EnableFeedbackForDevice( TTouchFeedbackType aFeedbackType ) + { + iDeviceFeedbackEnabled = aFeedbackType; + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::FeedbackEnabledForDeviceL +// --------------------------------------------------------------------------- +// +TTouchFeedbackType CTactileFeedbackSrv::FeedbackEnabledForDevice() + { + return static_cast( iDeviceFeedbackEnabled ); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::PlayPreviewFeedbackL +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::PlayPreviewFeedback( TInt aLevel, + TTouchLogicalFeedback aFeedback, + TTouchFeedbackType aType ) + { + iResolver->PlayPreviewFeedback( aLevel, aFeedback, aType ); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::StartPreviewFeedbackL +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::StartPreviewFeedback( TInt aLevel, + TTouchContinuousFeedback aFeedback, + TInt aIntensity, + TTouchFeedbackType aType ) + { + iResolver->StartPreviewFeedback( aLevel, aFeedback, aIntensity, aType ); + } + +// --------------------------------------------------------------------------- +// CTactileFeedbackSrv::StopPreviewFeedbackL +// --------------------------------------------------------------------------- +// +void CTactileFeedbackSrv::StopPreviewFeedback() + { + iResolver->StopPreviewFeedback(); + } + +// End of file diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactileplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactileplayer.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,163 @@ +/* +* 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: Interface class for tactile feedback players. +* Part of: Tactile Feedback. +* +*/ + +#include "tactileplayer.h" + +const TUid KTactilePlayerIFUid = {0x2001CBA7}; + +_LIT8( KTactileHaptics, "Haptics" ); +_LIT8( KTactileAudio, "Audio" ); + +// ======== LOCAL FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactilePlayer* CTactilePlayer::NewL( TUid aImplementationUid, + CRepository& aRepository ) + { + return static_cast ( REComSession::CreateImplementationL( + aImplementationUid, + _FOFF(CTactilePlayer, iDtor_ID_Key ), + &aRepository ) ); + } + +// --------------------------------------------------------------------------- +// Lists the available plugin implementations for this interface. +// --------------------------------------------------------------------------- +// +void CTactilePlayer::ListImplementationsL( TTactilePlayerType aType, + RImplInfoPtrArray& aImplInfoArray ) + { + if ( aType == ETactilePlayerAny ) + { + REComSession::ListImplementationsL( KTactilePlayerIFUid, + aImplInfoArray ); + } + else + { + RImplInfoPtrArray implInfoArray; + CleanupClosePushL( implInfoArray ); + REComSession::ListImplementationsL( KTactilePlayerIFUid, + implInfoArray ); + for( TInt i(0) ; i < implInfoArray.Count() ; i++ ) + { + switch( aType ) + { + case ETactilePlayerHaptics: + if ( !implInfoArray[i]->DataType().Compare( KTactileHaptics ) ) + { + aImplInfoArray.AppendL( implInfoArray[i] ); + } + break; + case ETactilePlayerAudio: + if ( !implInfoArray[i]->DataType().Compare( KTactileAudio ) ) + { + aImplInfoArray.AppendL( implInfoArray[i] ); + } + break; + default: + break; + } + } + CleanupStack::PopAndDestroy( &implInfoArray ); + } + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CTactilePlayer::~CTactilePlayer() + { + REComSession::DestroyedImplementation( iDtor_ID_Key ); + } + +// --------------------------------------------------------------------------- +// Start feedback. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CTactilePlayer::StartFeedback( TTouchContinuousFeedback /*aFeedback*/, + TInt /*aIntensity*/ ) + { + // Empty implementation for plugins, which don't support + // continuous feedback. + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// Modify feedback. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CTactilePlayer::ModifyFeedback( TInt /*aIntensity*/ ) + { + // Empty implementation for plugins, which don't support + // continuous feedback. + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// Stop feedback. +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactilePlayer::StopFeedback() + { + // Empty implementation for plugins, which don't support + // continuous feedback. + } + +// --------------------------------------------------------------------------- +// Maximum level. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CTactilePlayer::MaxLevel() + { + // Default implementation returns 1 as maximum level, which means that + // player has only one level. + return 1; + } + +// --------------------------------------------------------------------------- +// Play preview. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CTactilePlayer::PlayPreviewFeedback( TInt /*aLevel*/, + TTouchLogicalFeedback /*aFeedback*/ ) + { + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// Start preview. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CTactilePlayer::StartPreviewFeedback( TInt /*aLevel*/, + TTouchContinuousFeedback /*aFeedback*/, + TInt /*aIntensity*/ ) + { + return KErrNotSupported; + } + +// --------------------------------------------------------------------------- +// Stop preview. +// --------------------------------------------------------------------------- +// +EXPORT_C void CTactilePlayer::StopPreviewFeedback() + { + } diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/src/tactilepropertywatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/src/tactilepropertywatcher.cpp Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 for monitoring P&S property changes. +* Part of: Tactile Feedback. +* +*/ + +#include +#include + +#include "tactilepropertywatcher.h" + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +CTactilePropertyWatcher::CTactilePropertyWatcher( + MTactilePropertyObserver& aObserver, + const TUid aCategory, + const TInt aKey, + CActive::TPriority aPriority ) : + CActive( aPriority ), + iObserver( aObserver ), + iCategory( aCategory ), + iKey( aKey ) + + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::ConstructL() + { + User::LeaveIfError( iProperty.Attach( iCategory, iKey ) ); + + Subscribe(); + } + +// --------------------------------------------------------------------------- +// 2-phased constructor. +// --------------------------------------------------------------------------- +// +CTactilePropertyWatcher* CTactilePropertyWatcher::NewL( + MTactilePropertyObserver& aObserver, + const TUid aCategory, + const TInt aKey, + CActive::TPriority aPriority ) + { + CTactilePropertyWatcher* self = new (ELeave) + CTactilePropertyWatcher( aObserver, aCategory, aKey, aPriority ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CTactilePropertyWatcher::~CTactilePropertyWatcher() + { + Cancel(); + iProperty.Close(); + } + +// --------------------------------------------------------------------------- +// Retrieves an integer value associated with this property. +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::GetL( TInt& aValue ) + { + User::LeaveIfError( iProperty.Get( aValue ) ); + } + + +// --------------------------------------------------------------------------- +// Retrieves a buffer associated with this property. +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::GetL( TDes8& aValue ) + { + User::LeaveIfError( iProperty.Get( aValue ) ); + } + +// --------------------------------------------------------------------------- +// Retrieves an integer value associated with this property. +// --------------------------------------------------------------------------- +// +TInt CTactilePropertyWatcher::Get( TInt& aValue ) + { + return iProperty.Get( aValue ); + } + +// --------------------------------------------------------------------------- +// Retrieves a buffer associated with this property. +// --------------------------------------------------------------------------- +// +TInt CTactilePropertyWatcher::Get( TDes8& aValue ) + { + return iProperty.Get( aValue ); + } + +// --------------------------------------------------------------------------- +// Sets a P&S property to an integer value. The attached version of +// RProperty::Set is used which is faster than using RProperty::Set +// directly without attach. +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::SetL( const TInt aValue ) + { + User::LeaveIfError( iProperty.Set( aValue ) ); + } + +// --------------------------------------------------------------------------- +// Sets a P&S property to a (large)bytearray value. The attached version of +// RProperty::Set is used which is faster than using RProperty::Set +// directly without attach. +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::SetL( const TDesC8& aValue ) + { + User::LeaveIfError( iProperty.Set( aValue ) ); + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::Subscribe() + { + if ( !IsActive() ) + { + iProperty.Subscribe( iStatus ); + + SetActive(); + } + } + +// --------------------------------------------------------------------------- +// From class CActive +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::DoCancel() + { + iProperty.Cancel(); + } + +// --------------------------------------------------------------------------- +// From class CActive +// --------------------------------------------------------------------------- +// +void CTactilePropertyWatcher::RunL() + { + if ( iStatus.Int() == KErrNone ) + { + // Subscribe first, then notify the observer that a property + // has changed. + Subscribe(); + iObserver.PropertyChangedL( iCategory, iKey ); + } + else if ( iStatus.Int() == KErrNotFound ) + { + // We get here if a property gets deleted. We still need to subscribe + // to it because it might get redefined later. + Subscribe(); + } + } + +// End of File diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/traces/OstTraceDefinitions.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/traces/fixed_id.definitions Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,4 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TACTILE_PERFORMANCE=0x40 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_RESOLVER_PLAY_FEEDBACK_0=0x2 +[TRACE]TACTILE_PERFORMANCE[0x40]_TACTILE_RESOLVER_PLAY_FEEDBACK_1=0x1 diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/traces/tactilefeedbackresolverTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/traces/tactilefeedbackresolverTraces.h Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,16 @@ +// Created by TraceCompiler1.1.6 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __TACTILEFEEDBACKRESOLVERTRACES_H__ +#define __TACTILEFEEDBACKRESOLVERTRACES_H__ + +#define KOstTraceComponentID 0x2000b494 + +#define TACTILE_RESOLVER_PLAY_FEEDBACK_1 0x400001 +#define TACTILE_RESOLVER_PLAY_FEEDBACK_0 0x400002 + + +#endif + +// End of file + diff -r 000000000000 -r d54f32e146dd tactilefeedback/tactilefeedbackresolver/traces/tracebuilder.cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tactilefeedback/tactilefeedbackresolver/traces/tracebuilder.cache Thu Dec 17 08:53:38 2009 +0200 @@ -0,0 +1,30 @@ + + 536917140 + tactilefeedbackresolver + + 64 + TACTILE_PERFORMANCE + + e_TACTILE_RESOLVER_PLAY_FEEDBACK 1 + 1 + TACTILE_RESOLVER_PLAY_FEEDBACK_1 + + ../src/tactilefeedbackresolver.cpp + 158 + CTactileFeedbackResolver + PlayFeedback + + + + e_TACTILE_RESOLVER_PLAY_FEEDBACK 0 + 2 + TACTILE_RESOLVER_PLAY_FEEDBACK_0 + + ../src/tactilefeedbackresolver.cpp + 183 + CTactileFeedbackResolver + PlayFeedback + + + +