|
1 /* |
|
2 * Copyright (c) 2005 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 * Implements a watcher for MMC disk change events. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 #include "DevEncMmcObserver.h" |
|
24 |
|
25 |
|
26 EXPORT_C CMmcObserver* CMmcObserver::NewL( MMemoryCardObserver* aObserver, |
|
27 RFs* aFileServerSession ) |
|
28 { |
|
29 CMmcObserver* self = new(ELeave) CMmcObserver(); |
|
30 CleanupStack::PushL( self ); |
|
31 self->ConstructL( aObserver, aFileServerSession ); |
|
32 CleanupStack::Pop( self ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 void CMmcObserver::ConstructL( MMemoryCardObserver* aObserver, |
|
37 RFs* aFileServerSession ) |
|
38 { |
|
39 iObserver = aObserver; |
|
40 iFsSession = aFileServerSession; |
|
41 CActiveScheduler::Add( this ); |
|
42 } |
|
43 |
|
44 CMmcObserver::CMmcObserver() : CActive( EPriorityIdle ) |
|
45 { |
|
46 } |
|
47 |
|
48 CMmcObserver::~CMmcObserver() |
|
49 { |
|
50 Cancel(); |
|
51 } |
|
52 |
|
53 void CMmcObserver::DoCancel() |
|
54 { |
|
55 iFsSession->NotifyChangeCancel(); |
|
56 } |
|
57 |
|
58 void CMmcObserver::RunL() |
|
59 { |
|
60 //TRACES(RDebug::Print( _L("CMmcObserver::RunL status: %d"), iStatus.Int() ) ); |
|
61 iObserver->MMCStatusChangedL(); |
|
62 StartObserver(); |
|
63 } |
|
64 |
|
65 EXPORT_C void CMmcObserver::StartObserver() |
|
66 { |
|
67 //TRACES(RDebug::Print(_L("CMmcObserver::StartObserver"))); |
|
68 if ( IsActive() ) |
|
69 { |
|
70 Cancel(); |
|
71 } |
|
72 iFsSession->NotifyChange( ENotifyDisk, iStatus ); |
|
73 SetActive(); |
|
74 } |
|
75 |
|
76 // End of File |