tactilefeedback/tactilefeedbackclient/src/touchfeedbackimpl.cpp
branchRCL_3
changeset 37 09b094b73eb8
parent 36 39d4c97df8cb
equal deleted inserted replaced
36:39d4c97df8cb 37:09b094b73eb8
   753                 newCacheEntry.iClientHandle   = clientHandle;
   753                 newCacheEntry.iClientHandle   = clientHandle;
   754                 newCacheEntry.iVibraDisabled  = !aEnableVibra;
   754                 newCacheEntry.iVibraDisabled  = !aEnableVibra;
   755                 newCacheEntry.iAudioDisabled  = !aEnableAudio;
   755                 newCacheEntry.iAudioDisabled  = !aEnableAudio;
   756                 newCacheEntry.iVisible        = aControl->IsVisible();
   756                 newCacheEntry.iVisible        = aControl->IsVisible();
   757                 newCacheEntry.iDimmed         = aControl->IsDimmed();
   757                 newCacheEntry.iDimmed         = aControl->IsDimmed();
   758                 // if append fail just make its action like before
   758                         
   759                 TRAP_IGNORE( iControlCache.AppendL( newCacheEntry ) );
   759                 iControlCache.Append( newCacheEntry );                        
   760                 }
   760                 }
   761             }        
   761             }        
   762         }
   762         }
   763     }
   763     }
   764 
   764 
   971             audioEnabled = !iControlCache[cacheIndex].iAudioDisabled;
   971             audioEnabled = !iControlCache[cacheIndex].iAudioDisabled;
   972             }
   972             }
   973             
   973             
   974         if ( vibraEnabled || audioEnabled )
   974         if ( vibraEnabled || audioEnabled )
   975             {
   975             {
   976             TRACE4("CTouchFeedbackImpl::StartFeedback, type:=%d intensity:%d, timeout:%d", aType, aIntensity, aTimeout);
   976             TRACE4("CTouchFeedbackImpl::StartFeedback, type:=%d intensity:%d, timeout:%d", aType, aIntensity, aTimeout.Int());
   977             TUint32 clientHandle = ClientHandle( aControl );
   977             TUint32 clientHandle = ClientHandle( aControl );
   978             iClient->StartFeedback( clientHandle, 
   978             iClient->StartFeedback( clientHandle, 
   979                                     aType, 
   979                                     aType, 
   980                                     aIntensity, 
   980                                     aIntensity, 
   981                                     aTimeout );    
   981                                     aTimeout );    
  1143                aControl, aType, vibraEnabled, audioEnabled);
  1143                aControl, aType, vibraEnabled, audioEnabled);
  1144         iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled );   
  1144         iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled );   
  1145         }
  1145         }
  1146     }
  1146     }
  1147         
  1147         
  1148 // ---------------------------------------------------------------------------
       
  1149 // CTouchFeedbackImpl::InstantFeedback
       
  1150 // ---------------------------------------------------------------------------
       
  1151 //    
       
  1152 void CTouchFeedbackImpl::InstantFeedback( TTouchLogicalFeedback aType,
       
  1153                                           TTouchFeedbackType aFeedbackType )
       
  1154     {
       
  1155     if ( iClient && ( iAudioEnabledForThisApp || iVibraEnabledForThisApp ) )
       
  1156         {
       
  1157         // Initialize vibra and audio enablers as given in param.
       
  1158         TBool vibraEnabled = aFeedbackType & ETouchFeedbackVibra;
       
  1159         TBool audioEnabled = aFeedbackType & ETouchFeedbackAudio;
       
  1160 
       
  1161         // Check application level vibra and audio enablers
       
  1162         if ( !iVibraEnabledForThisApp )
       
  1163             {
       
  1164             vibraEnabled = EFalse;
       
  1165             }
       
  1166         if ( !iAudioEnabledForThisApp )
       
  1167             {
       
  1168             audioEnabled = EFalse;
       
  1169             }
       
  1170 
       
  1171         TRACE4( "CTouchFeedbackImpl::InstantFeedback, type:=%d Vibra:%d Audio:%d",
       
  1172                 aType, vibraEnabled, audioEnabled );
       
  1173         iClient->ImmediateFeedback( aType, vibraEnabled, audioEnabled );
       
  1174         }
       
  1175     }
       
  1176 
       
  1177 // ---------------------------------------------------------------------------
  1148 // ---------------------------------------------------------------------------
  1178 // Here we do the actual work for adding new area to the registry
  1149 // Here we do the actual work for adding new area to the registry
  1179 // (or updating an existing one).
  1150 // (or updating an existing one).
  1180 //
  1151 //
  1181 // #1 Check that control exist in the cache
  1152 // #1 Check that control exist in the cache
  1758         }
  1729         }
  1759     item.iEventType = aEventType;        
  1730     item.iEventType = aEventType;        
  1760     
  1731     
  1761 	// range check. update when logical feedback types are changed.
  1732 	// range check. update when logical feedback types are changed.
  1762     if ( !(aFeedback >= ETouchFeedbackNone && aFeedback <= ETouchFeedbackSensitive) 
  1733     if ( !(aFeedback >= ETouchFeedbackNone && aFeedback <= ETouchFeedbackSensitive) 
  1763             && !(aFeedback >= ETouchFeedbackBasicButton && aFeedback <= ETouchFeedbackLongPress) )
  1734             && !(aFeedback >= ETouchFeedbackBasicButton && aFeedback <= ETouchFeedbackMultiTouchRecognized) )
  1764         {
  1735         {
  1765         return KErrArgument;
  1736         return KErrArgument;
  1766         }
  1737         }
  1767     item.iFeedback = aFeedback;        
  1738     item.iFeedback = aFeedback;        
  1768     item.iFeedbackType = aFeedbackType;
  1739     item.iFeedbackType = aFeedbackType;
  1769         
  1740         
  1770     TInt err = iFbArray.Append(item);
  1741     iFbArray.Append(item);
  1771     return err;
  1742     return KErrNone;
  1772     }    
  1743     }    
  1773 
  1744 
  1774 // ---------------------------------------------------------------------------
  1745 // ---------------------------------------------------------------------------
  1775 //
  1746 //
  1776 // ---------------------------------------------------------------------------
  1747 // ---------------------------------------------------------------------------
  1785         {
  1756         {
  1786         TTactileFbItem item;
  1757         TTactileFbItem item;
  1787         item.iFeedback  = iFbArray[i].iFeedback;
  1758         item.iFeedback  = iFbArray[i].iFeedback;
  1788         item.iEventType = iFbArray[i].iEventType;
  1759         item.iEventType = iFbArray[i].iEventType;
  1789         item.iFeedbackType = iFbArray[i].iFeedbackType;
  1760         item.iFeedbackType = iFbArray[i].iFeedbackType;
  1790         // if append fail just make its action like before
  1761         aArray.Append(item);
  1791         TRAP_IGNORE( aArray.AppendL( item ) );
       
  1792         }
  1762         }
  1793     }
  1763     }
  1794 
  1764 
  1795 // ---------------------------------------------------------------------------
  1765 // ---------------------------------------------------------------------------
  1796 //
  1766 //