voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp
branchRCL_3
changeset 15 487b46c8e1a4
parent 14 f962425b9f8b
child 17 41c99112ff9d
--- a/voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp	Tue May 25 12:45:15 2010 +0300
+++ b/voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp	Wed Jun 09 09:44:44 2010 +0300
@@ -22,7 +22,8 @@
 
 CVRUSBStateHanlder::CVRUSBStateHanlder(MVRUSBStateObserver* aObserver) :
     CActive(EPriorityStandard), // Standard priority
-            iObserver(aObserver)
+            iObserver(aObserver),
+            iConnectionStatus(EStateUninitialized)
     {
     }
 
@@ -83,22 +84,39 @@
     {
 #ifdef DUMMY_USB_TESTING
     CDummyUSBState::HandleUSBEventL();
+#else
+    StartL();
 #endif
-    if (IsUsbActive())
+    
+ 
+    TBool isUsbActive (IsUsbActive());
+    
+    if (isUsbActive)
         {
-        iObserver->HandleUsbPlugInL();
+        if(iConnectionStatus != EStateConnected)
+            {
+            iObserver->HandleUsbPlugInL();
+            iConnectionStatus = EStateConnected;
+            }
         }
     else
         {
-        iObserver->HandleUsbPlugOutL();
+        if(iConnectionStatus != EStateDisConnected)
+            {
+            iObserver->HandleUsbPlugOutL();
+            iConnectionStatus = EStateDisConnected;
+            } 
         }
+
 #ifdef DUMMY_USB_TESTING    
     //    iStatus = KRequestPending;
     SetActive(); // Tell scheduler a request is active    
     iTimer.After(iStatus, 10000000); // Set for later
-#else
-    StartL();
+
+    
 #endif
+
+
     }
 
 TInt CVRUSBStateHanlder::RunError(TInt aError)