bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp
branchRCL_3
changeset 39 5a89845f78e2
parent 16 b23265fb36da
equal deleted inserted replaced
35:95674584745d 39:5a89845f78e2
   181 //----------------------------------------------------------------------------
   181 //----------------------------------------------------------------------------
   182 //
   182 //
   183 void CHidMouseDriver::LaunchApplicationL(const TDesC& aName)
   183 void CHidMouseDriver::LaunchApplicationL(const TDesC& aName)
   184     {
   184     {
   185     //Check if application is already running in the background
   185     //Check if application is already running in the background
   186     TApaTaskList tasks( iWsSession );
   186     if (IsAlreadyRunning())
   187     TApaTask task = tasks.FindApp( aName );
       
   188 
       
   189     if ( task.Exists() )
       
   190         {
   187         {
   191         // Application is active, so just bring to foreground
   188         // Application is active, so just bring to foreground
   192         }
   189         }
   193     else
   190     else
   194         {
   191         {
   206         arcSession.Close();
   203         arcSession.Close();
   207 
   204 
   208         CleanupStack::PopAndDestroy(2);
   205         CleanupStack::PopAndDestroy(2);
   209         }
   206         }
   210     }
   207     }
       
   208 
       
   209 TBool CHidMouseDriver::IsAlreadyRunning()
       
   210     {
       
   211     TFindProcess processFinder(_L("*[2001fe5c]*")); //search by paintcursor.exe UID3  
       
   212 
       
   213     TBool found = EFalse;
       
   214     TFullName result;
       
   215     if (processFinder.Next(result) == KErrNone)
       
   216         {
       
   217         DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - process found Inside while")) );
       
   218         found = ETrue;
       
   219         }
       
   220 
       
   221     if (found)
       
   222         {
       
   223         DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process found ")) );
       
   224         }
       
   225     else
       
   226         {
       
   227         DBG(RDebug::Print(_L("[BTHID] CHidMouseDriver::IsAlreadyRunning - Process was never found")) );
       
   228         }
       
   229         
       
   230     return found;
       
   231 }
       
   232 
       
   233 
   211 // ----------------------------------------------------------------------
   234 // ----------------------------------------------------------------------
   212 // CHidDriver mandatory functions:
   235 // CHidDriver mandatory functions:
   213 
   236 
   214 TInt CHidMouseDriver::DataIn(
   237 TInt CHidMouseDriver::DataIn(
   215     CHidTransport::THidChannelType aChannel, const TDesC8& aPayload)
   238     CHidTransport::THidChannelType aChannel, const TDesC8& aPayload)
   229                 err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
   252                 err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
   230                 DBG(RDebug::Print(
   253                 DBG(RDebug::Print(
   231                          _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
   254                          _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
   232                 }
   255                 }
   233 
   256 
       
   257             LaunchApplicationL(KAppName);
   234 
   258 
   235             CursorRedraw();
   259             CursorRedraw();
   236 
   260 
   237             InterruptData(aPayload);
   261             InterruptData(aPayload);
   238             }
   262             }