tactileclickplugin_stub/src/tactileclickpluginstub.cpp
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  The click maker plugin, which
       
    15 *                handles key events at window server process.
       
    16 * Part of:      Tactile Feedback.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #include <e32std.h>
       
    23 #include "tactileclickpluginstub.h"
       
    24 
       
    25 
       
    26 /**
       
    27  *  These are used as opcodes (function number) in IPC communication 
       
    28  *  between Tactile Feedback Client and the server hosting
       
    29  *  Tactile Area Registry (currently window server)
       
    30  */
       
    31 enum TTactileFeedbackOpCodes
       
    32     {
       
    33     ETactileOpCodeConnect = 200,
       
    34     ETactileOpCodeDisconnect = 201,
       
    35     ETactileOpCodeImmediateFeedback = 202
       
    36     };
       
    37 
       
    38 
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 
       
    43 CTactileClickPlugin::CTactileClickPlugin()
       
    44     {
       
    45     }
       
    46 
       
    47 
       
    48 void CTactileClickPlugin::ConstructL()
       
    49     {
       
    50     // We need to store ourselves to thead local storage, so that
       
    51     // Anim Dll plugins can access the feedback functionality
       
    52     Dll::SetTls( this );
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // We really have to trap ConstructL, because construction of click maker 
       
    58 // plug-in must not fail (otherwise WSERV will panic, resulting in KERN 4 and
       
    59 // re-boot of whole device).
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CTactileClickPlugin* CTactileClickPlugin::NewL()
       
    63     {
       
    64     CTactileClickPlugin* self = new( ELeave ) CTactileClickPlugin;
       
    65     TRAP_IGNORE( self->ConstructL() );
       
    66     return self;
       
    67     }
       
    68 
       
    69 
       
    70 CTactileClickPlugin::~CTactileClickPlugin()
       
    71     {
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // From class CClickMaker.
       
    77 // No implementation needed
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CTactileClickPlugin::KeyEvent( 
       
    81     TEventCode /*aType*/, const TKeyEvent& /*aEvent*/ )
       
    82     {    
       
    83     }
       
    84     
       
    85 // ---------------------------------------------------------------------------
       
    86 // From class CClickMaker.
       
    87 // No implementation needed
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CTactileClickPlugin::PointerEvent( const TPointerEvent& /*aEvent*/ )
       
    91     {
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // From class CClickMaker.
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 void CTactileClickPlugin::OtherEvent( TInt /*aType*/, TAny* /*aParam*/ )
       
    99     {
       
   100     }
       
   101 
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // From class CClickMaker.
       
   105 // This is run when client calls RSoundPlugin::CommandReply -function.
       
   106 //
       
   107 // Handling of individual commands has been moved to dedicated functions,
       
   108 // because data handling requires some effort and relively complex code.
       
   109 // This is due to the mistake in CClickMaker API design, as the data is
       
   110 // not delivered in the same format as it was passed to RSoundPlugin on
       
   111 // client side (client gives data in descriptor, but here the descriptor
       
   112 // needs to be re-built from TAny* pointer, and in addition the lenght
       
   113 // of data needs to be known based on command id).
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 TInt CTactileClickPlugin::CommandReplyL( TInt aOpcode, TAny* aArgs )
       
   117     {    
       
   118     TInt errCode = KErrNone;
       
   119     
       
   120     switch ( aOpcode )
       
   121         {
       
   122         case ETactileOpCodeConnect:
       
   123             errCode = HandleConnectL( aArgs );
       
   124             break;
       
   125         case ETactileOpCodeDisconnect:
       
   126             HandleDisconnectL( aArgs );
       
   127             break;
       
   128         case ETactileOpCodeImmediateFeedback:
       
   129             errCode = HandleImmediateFeedbackL( aArgs );
       
   130             break;
       
   131         default:
       
   132             break;
       
   133         }
       
   134     
       
   135     return errCode;    
       
   136     };
       
   137 
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // 
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CTactileClickPlugin::InstantFeedback( TTouchLogicalFeedback /*aType*/ )
       
   144     {
       
   145     }
       
   146 
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // This is not real plugin --> Always return KErrNotSupported
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 TInt CTactileClickPlugin::HandleConnectL( TAny* /*aArgs*/ )
       
   153     {
       
   154     return KErrNotSupported;
       
   155     }
       
   156     
       
   157     
       
   158 // ---------------------------------------------------------------------------
       
   159 // No need to do anything here
       
   160 // ---------------------------------------------------------------------------
       
   161 //
       
   162 void CTactileClickPlugin::HandleDisconnectL( TAny* /*aArgs*/ )
       
   163     {  
       
   164     }
       
   165 
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // No need to do anything here
       
   169 // ---------------------------------------------------------------------------
       
   170 //
       
   171 TInt CTactileClickPlugin::HandleImmediateFeedbackL( TAny* /*aArgs*/ )
       
   172     {
       
   173     return KErrNone;
       
   174     }
       
   175 
       
   176 
       
   177 // ======== GLOBAL FUNCTIONS ========
       
   178 
       
   179 // ---------------------------------------------------------------------------
       
   180 // Function with this signature needs to be the first exported function
       
   181 // in click maker plugin DLLs.
       
   182 //
       
   183 // Constructs and returns an instance to tactile click maker plugin.
       
   184 // ---------------------------------------------------------------------------
       
   185 //
       
   186 EXPORT_C CClickMaker* CreateClickMakerL()
       
   187     {
       
   188     CTactileClickPlugin* clickMaker = CTactileClickPlugin::NewL();
       
   189     return clickMaker;
       
   190     }