bluetoothengine/bthid/mouse/hidmousedriver/src/mouse.cpp
branchRCL_3
changeset 12 b23265fb36da
parent 0 f63038272f30
child 18 5a89845f78e2
equal deleted inserted replaced
11:f7fbeaeb166a 12:b23265fb36da
    94     DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver{0x%08x}::ConstructL() END"), this));
    94     DBG(RDebug::Print(_L("[HID]\tCHidMouseDriver{0x%08x}::ConstructL() END"), this));
    95     // Create a session with the window server:
    95     // Create a session with the window server:
    96     User::LeaveIfError(iWsSession.Connect());
    96     User::LeaveIfError(iWsSession.Connect());
    97     }
    97     }
    98 
    98 
    99 
       
   100 
       
   101 
       
   102 CHidMouseDriver::~CHidMouseDriver()
    99 CHidMouseDriver::~CHidMouseDriver()
   103     {
   100     {
   104     DBG(RDebug::Print(_L("[HID]\t~CHidMouseDriver() 0x%08x"), this));
   101     DBG(RDebug::Print(_L("[HID]\t~CHidMouseDriver() 0x%08x"), this));
   105 
   102 
   106     iPointBufQueue.Close();
   103     iPointBufQueue.Close();
   107 
   104 
   108     if (iDriverState == EInitialised || iDriverState == EDisabled )
   105     if (iDriverState == EInitialised || iDriverState == EDisabled )
   109         {
   106         {
   110         RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorHide );
   107         RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
   111         }
   108         }
   112 
   109 
   113     iWsSession.Close();
   110     iWsSession.Close();
   114     }
   111     }
   115 
   112 
   174     }
   171     }
   175 
   172 
   176 void CHidMouseDriver::Stop()
   173 void CHidMouseDriver::Stop()
   177     {
   174     {
   178     iDriverState = EDisabled;
   175     iDriverState = EDisabled;
   179     RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorHide );
   176     RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorNotInitialized );
   180     }
   177     }
   181 
   178 
   182 //----------------------------------------------------------------------------
   179 //----------------------------------------------------------------------------
   183 // CHidMouseDriver::LaunchApplicationL
   180 // CHidMouseDriver::LaunchApplicationL
   184 //----------------------------------------------------------------------------
   181 //----------------------------------------------------------------------------
   223         case CHidTransport::EHidChannelInt:
   220         case CHidTransport::EHidChannelInt:
   224         if (EInitialised == iDriverState)
   221         if (EInitialised == iDriverState)
   225             {
   222             {
   226             TInt mouseStatus;
   223             TInt mouseStatus;
   227             TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
   224             TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
   228             if ( !err && (static_cast<THidMouseCursorState>(mouseStatus) == ECursorHide) )
   225             if ( !err &&
       
   226                 ((static_cast<THidMouseCursorState>(mouseStatus) == ECursorRedraw)|| 
       
   227                  (static_cast<THidMouseCursorState>(mouseStatus) == ECursorReset)) )
   229                 {
   228                 {
   230                 err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
   229                 err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorShow );
       
   230                 DBG(RDebug::Print(
       
   231                          _L("[BTHID]\tCHidMouseDriver::DataIn() ECursorRedraw ||ECursorReset ")) );
   231                 }
   232                 }
       
   233 
       
   234 
       
   235             CursorRedraw();
       
   236 
   232             InterruptData(aPayload);
   237             InterruptData(aPayload);
   233             }
   238             }
   234         break;
   239         break;
   235 
   240 
   236         case CHidTransport::EHidChannelCtrl:
   241         case CHidTransport::EHidChannelCtrl:
   379         if (! iButton2Down )
   384         if (! iButton2Down )
   380             {
   385             {
   381             iButton2Down = ETrue;
   386             iButton2Down = ETrue;
   382             TRawEvent rawEvent;
   387             TRawEvent rawEvent;
   383             rawEvent.Set(TRawEvent::EKeyDown, EStdKeyApplication0);
   388             rawEvent.Set(TRawEvent::EKeyDown, EStdKeyApplication0);
       
   389             CursorRedraw();
   384             UserSvr::AddEvent(rawEvent);
   390             UserSvr::AddEvent(rawEvent);
   385             }
   391             }
   386         }
   392         }
   387     else
   393     else
   388         {
   394         {
   389         if (iButton2Down )
   395         if (iButton2Down )
   390             {
   396             {
   391             iButton2Down = EFalse;
   397             iButton2Down = EFalse;
   392             TRawEvent rawEvent;
   398             TRawEvent rawEvent;
   393             rawEvent.Set(TRawEvent::EKeyUp, EStdKeyApplication0);
   399             rawEvent.Set(TRawEvent::EKeyUp, EStdKeyApplication0);
       
   400             CursorRedraw();
   394             UserSvr::AddEvent(rawEvent);
   401             UserSvr::AddEvent(rawEvent);
   395             }
   402             }
   396         }
   403         }
   397 
   404 
   398     if (report.GetValue( button3, KButton3) == KErrNone && button3)
   405     if (report.GetValue( button3, KButton3) == KErrNone && button3)
   474 //
   481 //
   475 void CHidMouseDriver::SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg)
   482 void CHidMouseDriver::SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg)
   476     {
   483     {
   477     iInputHandlingReg = aHandlingReg;
   484     iInputHandlingReg = aHandlingReg;
   478     }
   485     }
       
   486 
       
   487 void CHidMouseDriver::CursorRedraw()
       
   488     {
       
   489     TInt mouseStatus;
       
   490 
       
   491     TInt err = RProperty::Get( KPSUidBthidSrv, KBTMouseCursorState, mouseStatus );
       
   492     if ( !err )
       
   493         {
       
   494         err = RProperty::Set( KPSUidBthidSrv, KBTMouseCursorState, ECursorRedraw );
       
   495         DBG(RDebug::Print(
       
   496              _L("[BTHID]\tCHidMouseDriver::ForegroundEventL() X->ECursorRedraw") ) );
       
   497         }
       
   498     }
   479 // ----------------------------------------------------------------------
   499 // ----------------------------------------------------------------------