|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 |
|
20 #include "chswiusbobserver.h" |
|
21 #include "chswiusbhandler.h" |
|
22 |
|
23 // ---------------------------------------------------------------------------- |
|
24 // CCHSwiUsbObserver::NewL() |
|
25 // two-phase constructor |
|
26 // ---------------------------------------------------------------------------- |
|
27 // |
|
28 CCHSwiUsbObserver* CCHSwiUsbObserver::NewL( CCHSwiUsbHandler* aHandler, RFs& aFs ) |
|
29 { |
|
30 CCHSwiUsbObserver* self = |
|
31 new(ELeave) CCHSwiUsbObserver( aHandler, aFs ); |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // ---------------------------------------------------------------------------- |
|
39 // CCHSwiUsbObserver::CCHSwiUsbObserver() |
|
40 // C++ default constructor |
|
41 // ---------------------------------------------------------------------------- |
|
42 // |
|
43 CCHSwiUsbObserver::CCHSwiUsbObserver( CCHSwiUsbHandler* aHandler, RFs& aFs ) |
|
44 : CActive( CActive::EPriorityUserInput ), |
|
45 iFs( aFs ), |
|
46 iUsbHandler( aHandler ) |
|
47 { |
|
48 CActiveScheduler::Add( this ); |
|
49 } |
|
50 |
|
51 // ---------------------------------------------------------------------------- |
|
52 // CCHSwiUsbObserver::ConstructL() |
|
53 // Symbian default constructor |
|
54 // ---------------------------------------------------------------------------- |
|
55 // |
|
56 void CCHSwiUsbObserver::ConstructL() |
|
57 { |
|
58 } |
|
59 |
|
60 // ---------------------------------------------------------------------------- |
|
61 // CCHSwiUsbObserver::~CCHSwiUsbObserver() |
|
62 // destructor |
|
63 // ---------------------------------------------------------------------------- |
|
64 // |
|
65 CCHSwiUsbObserver::~CCHSwiUsbObserver() |
|
66 { |
|
67 Cancel(); |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CCHSwiUsbObserver::DoCancel() |
|
72 // |
|
73 // ---------------------------------------------------------------------------- |
|
74 // |
|
75 void CCHSwiUsbObserver::DoCancel() |
|
76 { |
|
77 iFs.NotifyChangeCancel( iStatus ); |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CCHSwiUsbObserver::Start() |
|
82 // Start monitoring. |
|
83 // ---------------------------------------------------------------------------- |
|
84 // |
|
85 void CCHSwiUsbObserver::Start() |
|
86 { |
|
87 Cancel(); |
|
88 iFs.NotifyChange( ENotifyDisk, iStatus ); |
|
89 SetActive(); |
|
90 } |
|
91 |
|
92 // ---------------------------------------------------------------------------- |
|
93 // CCHSwiUsbObserver::RunL() |
|
94 // Handle notifications of MMC events. |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 void CCHSwiUsbObserver::RunL() |
|
98 { |
|
99 iUsbHandler->PostponedDriveScan(); |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // CCHSwiUsbObserver::RunError() |
|
104 // |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CCHSwiUsbObserver::RunError( TInt /*aError*/) |
|
108 { |
|
109 return KErrNone; |
|
110 } |
|
111 |