Symbian3/PDK/Source/GUID-623CA1EE-4D25-495A-BD2F-BA7BF95D6D9C.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-623CA1EE-4D25-495A-BD2F-BA7BF95D6D9C" xml:lang="en"><title>Creating
       
    13 a Vibra instance to control the vibra</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    14 <context>       <p>A <codeph>CHWRMVibra</codeph> instance can be created by
       
    15 using <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> methods. After this,
       
    16 vibra can be directly controlled via the provided class methods.</p><p><b>Without
       
    17 notify handling</b></p><p>The user has to create an instance of the <codeph>CHWRMVibra</codeph> implementation
       
    18 class using the <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> constructor
       
    19 without a parameter. The following code snippet demonstrates how to create
       
    20 an instance without notify handling to control the device vibra:</p><codeblock xml:space="preserve">CHWRMVibra* vibra = CHWRMVibra::NewLC(); // No callbacks</codeblock><p><b>With notify handling </b></p><p>The client must derive a class from
       
    21 the <codeph>MHWRMVibraObserver</codeph> interface and implement the <codeph>VibraModeChanged()</codeph> and <codeph>VibraStatusChanged()</codeph> methods.</p><p>The following code snippet gives an example of the header of the class
       
    22 implemented by the client:</p><codeblock xml:space="preserve">// INCLUDES
       
    23 #include HWRMVibra.h // Link against HWRMVibraClient.lib.
       
    24 class CVibraStatusObserver : public CBase,
       
    25                              public MHWRMVibraObserver
       
    26     {
       
    27     public:
       
    28         CVibraStatusObserver();
       
    29         ~CVibraStatusObserver();
       
    30         void ConstructL();
       
    31         static CVibraStatusObserver* NewL(); 
       
    32         // from MHWRMVibraObserver
       
    33         virtual void VibraModeChanged( CHWRMVibra::TVibraModeState aStatus );
       
    34         virtual void VibraStatusChanged( CHWRMVibra::TVibraStatus aStatus );
       
    35     private:
       
    36         CHWRMVibra* iVibra;
       
    37     };
       
    38 </codeblock><p>Create an instance of the <codeph>CHWRMVibra</codeph> implementation
       
    39 class using the <codeph>NewL()</codeph> or <codeph>NewLC()</codeph> constructor
       
    40 with a parameter. This parameter is a pointer to an object that is derived
       
    41 from <codeph>MHWRMVibraObserver</codeph>. Every vibra user setting profile
       
    42 change causes the notification using <codeph>MHWRMVibraObserver::VibraModeChanged()</codeph>.
       
    43 Every vibra status change causes the notification using <codeph>MHWRMVibraObserver::VibraStatusChanged()</codeph>. </p><p>The
       
    44 following code snippet demonstrates how to create an instance with notify
       
    45 handling to control the device vibra:</p><codeblock xml:space="preserve">void CVibraStatusObserver::ConstructL()
       
    46     {
       
    47     iVibra = CHWRMVibra::NewL( this )
       
    48     }</codeblock></context>
       
    49 </taskbody></task>