|
1 /* |
|
2 * Copyright (c) 2007-2008 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: ECOM implementation for touch indicator |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "debug.h" |
|
19 #include "lcstylustapdismount.h" |
|
20 #include "driveinfo.h" |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // Destructor. |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 CLcStylusTapDismount::~CLcStylusTapDismount() |
|
27 { |
|
28 TRACE_FUNC |
|
29 Cancel(); |
|
30 delete iDismountTimer; |
|
31 iRFs.Close(); |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // Symbian two phase constructor. |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CLcStylusTapDismount* CLcStylusTapDismount::NewL() |
|
39 { |
|
40 TRACE_FUNC |
|
41 CLcStylusTapDismount* self = CLcStylusTapDismount::NewLC(); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Symbian two phase constructor. Object pushed to cleanup stack |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CLcStylusTapDismount* CLcStylusTapDismount::NewLC() |
|
51 { |
|
52 TRACE_FUNC |
|
53 |
|
54 CLcStylusTapDismount* self = new (ELeave) CLcStylusTapDismount(); |
|
55 CleanupStack::PushL(self); |
|
56 self->ConstructL(); |
|
57 |
|
58 return self; |
|
59 |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // Returning of previous notifier and starting of new one |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CLcStylusTapDismount::RunL() |
|
67 { |
|
68 TRACE_FUNC |
|
69 |
|
70 delete iDismountTimer; |
|
71 iDismountTimer = NULL; |
|
72 |
|
73 if ( iDriveIndex < KMaxDrives ) |
|
74 { |
|
75 DoDismount(); |
|
76 } |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Cancel pending notifier and those in queue |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CLcStylusTapDismount::DoCancel() |
|
84 { |
|
85 TRACE_FUNC |
|
86 iRFs.NotifyDismountCancel(iStatus); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // C++ constructor |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 CLcStylusTapDismount::CLcStylusTapDismount() |
|
94 : CActive(EPriorityStandard) |
|
95 { |
|
96 TRACE_FUNC |
|
97 CActiveScheduler::Add(this); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // 2nd-phase constructor |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CLcStylusTapDismount::ConstructL() |
|
105 { |
|
106 TRACE_FUNC |
|
107 User::LeaveIfError( iRFs.Connect()); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // Dismount drive |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 void CLcStylusTapDismount::DisMountUsbDrives() |
|
115 { |
|
116 TRACE_FUNC |
|
117 Cancel(); |
|
118 iDriveIndex = 0; |
|
119 iRFs.DriveList( iDriveList ); |
|
120 DoDismount(); |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // Dismount next drive |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 void CLcStylusTapDismount::DoDismount() |
|
128 { |
|
129 TRACE_FUNC |
|
130 TUint driveStatus( 0 ); |
|
131 |
|
132 for ( ; iDriveIndex < KMaxDrives; iDriveIndex++ ) |
|
133 { |
|
134 if ( iDriveList[iDriveIndex] ) |
|
135 { |
|
136 DriveInfo::GetDriveStatus( iRFs, iDriveIndex, driveStatus ); |
|
137 if ( driveStatus & DriveInfo::EDriveUsbMemory ) |
|
138 { |
|
139 TRACE_INFO(_L("CLcStylusTapDismount::DoDismount Dismount notify request ")); |
|
140 iRFs.NotifyDismount( iDriveIndex, iStatus, EFsDismountNotifyClients ); |
|
141 TRAP_IGNORE( iDismountTimer = CForceDismountTimer::NewL(this) ); |
|
142 SetActive(); |
|
143 break; |
|
144 } |
|
145 } |
|
146 } |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // Dismount next drive |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CLcStylusTapDismount::TimerExpired() |
|
154 { |
|
155 TRACE_FUNC |
|
156 |
|
157 Cancel(); |
|
158 delete iDismountTimer; |
|
159 iDismountTimer = NULL; |
|
160 iRFs.NotifyDismount( iDriveIndex, iStatus, EFsDismountForceDismount ); |
|
161 SetActive(); |
|
162 |
|
163 } |
|
164 // End of File |