tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp
branchRCL_3
changeset 36 39d4c97df8cb
parent 34 d57e599df233
child 37 09b094b73eb8
equal deleted inserted replaced
34:d57e599df233 36:39d4c97df8cb
    33 
    33 
    34 // Minimun and maximum sized of one shared memory chunk.
    34 // Minimun and maximum sized of one shared memory chunk.
    35 const TInt KTactileChunkInitialSize = 4096; // 4kB
    35 const TInt KTactileChunkInitialSize = 4096; // 4kB
    36 const TInt KTactileChunkMaxSize     = 262144; // 256kB
    36 const TInt KTactileChunkMaxSize     = 262144; // 256kB
    37 const TUid KTactileClickPluginUid   = { 0x2000B493 };
    37 const TUid KTactileClickPluginUid   = { 0x2000B493 };
    38 
       
    39 _LIT( KChunkNameFormat, "PID_0x%Lx_TID_0x%Lx" );
       
    40 // ======== MEMBER FUNCTIONS ========
    38 // ======== MEMBER FUNCTIONS ========
    41 
    39 
    42 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    43 // 
    41 // 
    44 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    86         {
    84         {
    87         User::Leave( KErrNotSupported );
    85         User::Leave( KErrNotSupported );
    88         }
    86         }
    89 
    87 
    90     // #2 Create shared chunk 
    88     // #2 Create shared chunk 
       
    89     RThread me;
       
    90 
    91     TTactileFeedbackConnectData data;
    91     TTactileFeedbackConnectData data;
    92     
    92     
    93     // Set window group identifier
    93     // Set window group identifier
    94     data.iWindowGroupId = CCoeEnv::Static()->RootWin().Identifier();
    94     data.iWindowGroupId = CCoeEnv::Static()->RootWin().Identifier();
    95            
    95            
    96     // We use our own process id and thread id as name for the chunk
    96     // We use our own thread name as name for the chunk       
    97     data.iChunkName.Format( KChunkNameFormat,
    97     data.iChunkName.Copy( me.Name().Right( KMaxKernelName ) );
    98                             RProcess().Id().Id(), RThread().Id().Id() );
       
    99     
    98     
   100     // Now create the chunk
    99     // Now create the chunk
   101     TInt err = iChunk.CreateGlobal( data.iChunkName, 
   100     TInt err = iChunk.CreateGlobal( data.iChunkName, 
   102                                     KTactileChunkInitialSize, 
   101                                     KTactileChunkInitialSize, 
   103                                     KTactileChunkMaxSize );     
   102                                     KTactileChunkMaxSize );     
   612         iFbClient.StopFeedback();
   611         iFbClient.StopFeedback();
   613         iFeedbackTimer->Cancel();
   612         iFeedbackTimer->Cancel();
   614         // Clear also client handle to indicate there's no ongoing feedback.
   613         // Clear also client handle to indicate there's no ongoing feedback.
   615         iClientHandle = 0; 
   614         iClientHandle = 0; 
   616         }
   615         }
   617     else if ( !iClientHandle ) // Stop instant feedback
       
   618         {
       
   619         iFbClient.StopFeedback();
       
   620         }
       
   621     TRACE("CTouchFeedbackClient::StopFeedback - End");
   616     TRACE("CTouchFeedbackClient::StopFeedback - End");
   622     }    
   617     }    
   623 
   618 
   624 // ---------------------------------------------------------------------------
   619 // ---------------------------------------------------------------------------
   625 // 
   620 //