| ID | ... | Creation date | 03.11.2008 |
| Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic. |
| Category | Symbian C++ | Subcategory | Touch UI |
| Keywords (APIs, classes, methods, functions): VibraFeedbackModeChanged(),MHWRMVibraFeedbackObserver ,Tactile Feedback Vibration Mode |
This snippet shows how to Monitor Touch Screen Vibration Mode Change.
This snippet can be self-signed.
Here we assume that we already have a working application.
The following capabilities and libraries are required:
CAPABILITY None
LIBRARY HWRMVibraClient.lib
<STEP 1>
Whatever Client that needs to monitor Touch Screen Vibration should derive from the MHWRMVibraFeedbackObserver interface and implement the VibraFeedbackModeChanged() method.
#include <HWRMVibra.h>
class CVibrationModeMonitorAppView : public CCoeControl, public MHWRMVibraFeedbackObserver
{
...
public:
// from MHWRMVibraFeedbackObserver
virtual void VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode);
...
private:
/**
* Owned
* CHWRMVibra instance
*/
CHWRMVibra* iVibra;
};
<STEP 2>
Create CHWRMVibra instance and set CVibrationModeMonitorAppView as observer for notification of feedback setting change.
void CVibrationModeMonitorAppView::ConstructL(const TRect& aRect)
{
...
iVibra = CHWRMVibra::NewL();
// Set View as observer for notification of feedback setting change //
iVibra->SetFeedbackObserver(this);
...
}
<STEP 3>
Implement VibraFeedbackModeChanged().
void CVibrationModeMonitorAppView::VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode)
{
// Create new CAknGlobalNote instance.
CAknGlobalNote* globalNote = CAknGlobalNote::NewL();
// Push CAknGlobalNote's pointer to CleanupStack
CleanupStack::PushL( globalNote );
TBuf<KMaxMessageLen> message;
switch ( aMode )
{
case CHWRMVibra::EVibraFeedbackModeON:
message.Copy( KVibraModeOn );
globalNote->ShowNoteL( EAknGlobalInformationNote, message );
break;
case CHWRMVibra::EVibraFeedbackModeOFF:
message.Copy( KVibraModeOff );
globalNote->ShowNoteL( EAknGlobalInformationNote, message );
break;
default:
break;
}
// Pop and Destroy CAknGlobalNote's pointer from CleanupStack
CleanupStack::PopAndDestroy();
}
<STEP 4>
Testing : For testing the Vibration Mode, run the attached application, keep the application running in the background and then try to enable/disable tactile feedback through Control Panel -> Personal -> Profiles -> <Profile_in_use> -> <Personalise> -> Touch Screen Tones.
After changing the status you will see the appropriate message on the profile screen itself, because we have used Global Notes in the example.
Appropriate Tactile Feedback Vibration Mode Status Events will be received by CVibrationModeMonitorAppView displaying notes with appropriate message.
No related wiki articles found