tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp
branchRCL_3
changeset 36 39d4c97df8cb
parent 21 f35d4b6d212e
child 37 09b094b73eb8
--- a/tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp	Thu Aug 19 10:13:11 2010 +0300
+++ b/tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp	Tue Aug 31 15:30:39 2010 +0300
@@ -755,8 +755,8 @@
                 newCacheEntry.iAudioDisabled  = !aEnableAudio;
                 newCacheEntry.iVisible        = aControl->IsVisible();
                 newCacheEntry.iDimmed         = aControl->IsDimmed();
-                        
-                iControlCache.Append( newCacheEntry );                        
+                // if append fail just make its action like before
+                TRAP_IGNORE( iControlCache.AppendL( newCacheEntry ) );
                 }
             }        
         }
@@ -973,7 +973,7 @@
             
         if ( vibraEnabled || audioEnabled )
             {
-            TRACE4("CTouchFeedbackImpl::StartFeedback, type:=%d intensity:%d, timeout:%d", aType, aIntensity, aTimeout.Int());
+            TRACE4("CTouchFeedbackImpl::StartFeedback, type:=%d intensity:%d, timeout:%d", aType, aIntensity, aTimeout);
             TUint32 clientHandle = ClientHandle( aControl );
             iClient->StartFeedback( clientHandle, 
                                     aType, 
@@ -1146,6 +1146,35 @@
     }
         
 // ---------------------------------------------------------------------------
+// CTouchFeedbackImpl::InstantFeedback
+// ---------------------------------------------------------------------------
+//    
+void CTouchFeedbackImpl::InstantFeedback( TTouchLogicalFeedback aType,
+                                          TTouchFeedbackType aFeedbackType )
+    {
+    if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) )
+        {
+        // Initialize vibra and audio enablers as given in param.
+        TBool vibraEnabled = aFeedbackType & ETouchFeedbackVibra;
+        TBool audioEnabled = aFeedbackType & ETouchFeedbackAudio;
+
+        // Check application level vibra and audio enablers
+        if ( !iVibraEnabledForThisApp )
+            {
+            vibraEnabled = EFalse;
+            }
+        if ( !iAudioEnabledForThisApp )
+            {
+            audioEnabled = EFalse;
+            }
+
+        TRACE4( "CTouchFeedbackImpl::InstantFeedback, type:=%d Vibra:%d Audio:%d",
+                aType, vibraEnabled, audioEnabled );
+        iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled );
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // Here we do the actual work for adding new area to the registry
 // (or updating an existing one).
 //
@@ -1731,15 +1760,15 @@
     
 	// range check. update when logical feedback types are changed.
     if ( !(aFeedback >= ETouchFeedbackNone && aFeedback <= ETouchFeedbackSensitive) 
-            && !(aFeedback >= ETouchFeedbackBasicButton && aFeedback <= ETouchFeedbackMultiTouchRecognized) )
+            && !(aFeedback >= ETouchFeedbackBasicButton && aFeedback <= ETouchFeedbackLongPress) )
         {
         return KErrArgument;
         }
     item.iFeedback = aFeedback;        
     item.iFeedbackType = aFeedbackType;
         
-    iFbArray.Append(item);
-    return KErrNone;
+    TInt err = iFbArray.Append(item);
+    return err;
     }    
 
 // ---------------------------------------------------------------------------
@@ -1758,7 +1787,8 @@
         item.iFeedback  = iFbArray[i].iFeedback;
         item.iEventType = iFbArray[i].iEventType;
         item.iFeedbackType = iFbArray[i].iFeedbackType;
-        aArray.Append(item);
+        // if append fail just make its action like before
+        TRAP_IGNORE( aArray.AppendL( item ) );
         }
     }