usbengines/usbotgwatcher/src/cusbnotifmanager.cpp
changeset 1 705ec7b86991
parent 0 1e05558e2206
child 6 a15c582fbf97
equal deleted inserted replaced
0:1e05558e2206 1:705ec7b86991
    88 MWaitNotifierObserver* CWaitNotifierInfo::Observer() const
    88 MWaitNotifierObserver* CWaitNotifierInfo::Observer() const
    89     {
    89     {
    90     return iObserver;
    90     return iObserver;
    91     }
    91     }
    92 
    92 
    93 // ---------------------------------------------------------------------------
    93 
    94 // 
    94 // ---------------------------------------------------------------------------
    95 // ---------------------------------------------------------------------------
    95 // 
    96 //
    96 // ---------------------------------------------------------------------------
    97 CUsbNotifManager::CUsbNotifManager()
    97 //
    98     {
    98 CUsbNotifManager* CUsbNotifManager::NewL(CUsbOtgWatcher* aOtgWatcher)
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // 
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 void CUsbNotifManager::ConstructL()
       
   106     {
       
   107 
       
   108         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) );
       
   109 
       
   110     User::LeaveIfError(iNotifier.Connect());
       
   111 
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // 
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CUsbNotifManager* CUsbNotifManager::NewL()
       
   119     {
    99     {
   120 
   100 
   121         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
   101         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::NewL" ) );
   122 
   102 
   123     CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
   103     CUsbNotifManager* self = new (ELeave) CUsbNotifManager();
   124     CleanupStack::PushL(self);
   104     CleanupStack::PushL(self);
   125     self->ConstructL();
   105     self->ConstructL(aOtgWatcher);
   126     CleanupStack::Pop(self);
   106     CleanupStack::Pop(self);
   127     return self;
   107     return self;
   128     }
   108     }
   129 
   109 
   130 // ---------------------------------------------------------------------------
   110 // ---------------------------------------------------------------------------
   131 // 
   111 // 
   132 // ---------------------------------------------------------------------------
   112 // ---------------------------------------------------------------------------
   133 //
   113 //
       
   114 void CUsbNotifManager::ConstructL(CUsbOtgWatcher* aOtgWatcher)
       
   115     {
       
   116 
       
   117         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::ConstructL" ) );
       
   118 
       
   119     User::LeaveIfError(iNotifier.Connect());
       
   120     
       
   121     iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this, aOtgWatcher);
       
   122 
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // 
       
   127 // ---------------------------------------------------------------------------
       
   128 //
       
   129 CUsbNotifManager::CUsbNotifManager()
       
   130     {
       
   131 
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // 
       
   136 // ---------------------------------------------------------------------------
       
   137 //
   134 CUsbNotifManager::~CUsbNotifManager()
   138 CUsbNotifManager::~CUsbNotifManager()
   135     {
   139     {
   136 
   140 
   137         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
   141     FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::~CUsbNotifManager" ) );
   138 
   142 
   139     CloseAllNotifiers();
   143     CloseAllNotifiers();
   140 
   144     
       
   145     delete iIndicatorNotifier;
       
   146     
   141     iNotifier.Close();
   147     iNotifier.Close();
   142 
   148 
   143     }
   149     }
   144 
   150 
   145 // ---------------------------------------------------------------------------
   151 // ---------------------------------------------------------------------------
   198 
   204 
   199     CleanupStack::Pop(notifier);    
   205     CleanupStack::Pop(notifier);    
   200     }
   206     }
   201 
   207 
   202 // ---------------------------------------------------------------------------
   208 // ---------------------------------------------------------------------------
   203 // 
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 void CUsbNotifManager::BlinkIndicatorL(TBool aBlinking)
       
   207     {
       
   208         FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::BlinkIndicatorL, aBlinking=%d" ), aBlinking));
       
   209 
       
   210     if (!iIndicatorNotifier)
       
   211         iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
       
   212 
       
   213     if (aBlinking)
       
   214         iIndicatorNotifier->ShowL();
       
   215     else
       
   216         iIndicatorNotifier->Close();
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // 
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 void CUsbNotifManager::ShowIndicatorL(TBool aVisible)
       
   224     {
       
   225         FTRACE( FPrint(_L( "[USBOTGWATCHER]\tCUsbNotifManager::ShowIndicatorL, aVisible=%d" ), aVisible ));
       
   226 
       
   227     if (!iIndicatorNotifier)
       
   228         iIndicatorNotifier = CUsbIndicatorNotifier::NewL(this);
       
   229 
       
   230     iIndicatorNotifier->ShowIndicatorL(aVisible);
       
   231     }
       
   232 
       
   233 // ---------------------------------------------------------------------------
       
   234 //
   209 //
   235 // ---------------------------------------------------------------------------
   210 // ---------------------------------------------------------------------------
   236 //
   211 //
   237 void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier* aWaitNotifier,
   212 void CUsbNotifManager::NotifierShowCompletedL(CUsbNotifier* aWaitNotifier,
   238         TInt aResult, TInt aFeedback)
   213         TInt aResult, TInt aFeedback)
   262 void CUsbNotifManager::CloseAllNotifiers()
   237 void CUsbNotifManager::CloseAllNotifiers()
   263     {
   238     {
   264         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) );
   239         FLOG( _L( "[USBOTGWATCHER]\tCUsbNotifManager::CloseAllNotifiers" ) );
   265 
   240 
   266     iWaitNotifiers.ResetAndDestroy();
   241     iWaitNotifiers.ResetAndDestroy();
   267     delete iIndicatorNotifier;
   242     iIndicatorNotifier->Close();
   268     iIndicatorNotifier = NULL;
   243     }
   269     }