tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp
branchRCL_3
changeset 37 09b094b73eb8
parent 36 39d4c97df8cb
child 46 df6ad9bd4687
--- a/tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp	Tue Aug 31 15:30:39 2010 +0300
+++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackclient.cpp	Wed Sep 01 12:23:25 2010 +0100
@@ -35,6 +35,8 @@
 const TInt KTactileChunkInitialSize = 4096; // 4kB
 const TInt KTactileChunkMaxSize     = 262144; // 256kB
 const TUid KTactileClickPluginUid   = { 0x2000B493 };
+
+_LIT( KChunkNameFormat, "PID_0x%Lx_TID_0x%Lx" );
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
@@ -86,15 +88,14 @@
         }
 
     // #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 ) );
+    // We use our own process id and thread id as name for the chunk
+    data.iChunkName.Format( KChunkNameFormat,
+                            RProcess().Id().Id(), RThread().Id().Id() );
     
     // Now create the chunk
     TInt err = iChunk.CreateGlobal( data.iChunkName, 
@@ -613,6 +614,10 @@
         // Clear also client handle to indicate there's no ongoing feedback.
         iClientHandle = 0; 
         }
+    else if ( !iClientHandle ) // Stop instant feedback
+        {
+        iFbClient.StopFeedback();
+        }
     TRACE("CTouchFeedbackClient::StopFeedback - End");
     }