author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:44:03 +0100 | |
branch | GCC_SURGE |
changeset 63 | ef2686f7597e |
parent 26 | 0ae0f29418cd |
parent 38 | 218231f2b3b3 |
permissions | -rw-r--r-- |
35 | 1 |
/* |
2 |
* Copyright (c) 2009 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: Base classes for Usb notifier wrapper |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "cusbnotifmanager.h" |
|
19 |
#include "cusbnotenotifier.h" |
|
20 |
||
21 |
#include "debug.h" |
|
22 |
#include "panic.h" |
|
23 |
||
24 |
// ======== MEMBER FUNCTIONS ======== |
|
25 |
||
26 |
// --------------------------------------------------------------------------- |
|
27 |
// C++ constructor |
|
28 |
// --------------------------------------------------------------------------- |
|
29 |
// |
|
30 |
CUsbNoteNotifier::CUsbNoteNotifier(RNotifier& aNotifier, |
|
31 |
CUsbNotifManager& aNotifManager, TUid aCat, TUint aNotifId) : |
|
32 |
CUsbNotifier(aNotifManager, aCat, aNotifId), iNotifier(aNotifier) |
|
33 |
{ |
|
34 |
} |
|
35 |
||
36 |
// --------------------------------------------------------------------------- |
|
37 |
// Second-phase constructor |
|
38 |
// --------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
void CUsbNoteNotifier::ConstructL() |
|
41 |
{ |
|
42 |
LOG_FUNC |
|
43 |
||
44 |
iNotifierActive = new (ELeave) CUsbNoteNotifier::CNotifierActive( |
|
45 |
iNotifier, *this); |
|
46 |
} |
|
47 |
||
48 |
// --------------------------------------------------------------------------- |
|
49 |
// Destructor |
|
50 |
// --------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
CUsbNoteNotifier::~CUsbNoteNotifier() |
|
53 |
{ |
|
54 |
LOG_FUNC |
|
55 |
||
56 |
delete iNotifierActive; |
|
57 |
} |
|
58 |
||
59 |
// --------------------------------------------------------------------------- |
|
60 |
// From base class CUsbNotifier |
|
61 |
// --------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
void CUsbNoteNotifier::ShowL() |
|
64 |
{ |
|
65 |
LOG_FUNC |
|
66 |
||
67 |
LOG2( "aCat = 0x%X aNotifId = 0x%X" , iCat, iNotifId); |
|
68 |
||
69 |
iNotifierActive->StartL(); |
|
70 |
} |
|
71 |
||
72 |
// --------------------------------------------------------------------------- |
|
73 |
// From base class CUsbNotifier |
|
74 |
// --------------------------------------------------------------------------- |
|
75 |
// |
|
76 |
void CUsbNoteNotifier::Close() |
|
77 |
{ |
|
78 |
} |
|
79 |
||
80 |
// ======== MEMBER FUNCTIONS ======== |
|
81 |
||
82 |
// --------------------------------------------------------------------------- |
|
83 |
// C++ default constructor |
|
84 |
// --------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
CUsbNoteNotifier::CNotifierActive::CNotifierActive(RNotifier& aNotifier, |
|
87 |
CUsbNoteNotifier& aUsbNoteNotifier) : |
|
88 |
CUsbNoteNotifier::CNotifierActive::CActive(EPriorityStandard), |
|
89 |
iUsbNoteNotifier(aUsbNoteNotifier), iNotifier(aNotifier), iRes(0) |
|
90 |
{ |
|
91 |
CActiveScheduler::Add(this); |
|
92 |
} |
|
93 |
||
94 |
// --------------------------------------------------------------------------- |
|
95 |
// Destructor |
|
96 |
// --------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
CUsbNoteNotifier::CNotifierActive::~CNotifierActive() |
|
99 |
{ |
|
100 |
Cancel(); |
|
101 |
} |
|
102 |
||
103 |
// --------------------------------------------------------------------------- |
|
104 |
// Start to show the notifier |
|
105 |
// --------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
void CUsbNoteNotifier::CNotifierActive::StartL() |
|
108 |
{ |
|
109 |
LOG_FUNC |
|
110 |
||
111 |
if (IsActive()) |
|
112 |
{ |
|
113 |
PANIC( ENotifierIsActiveAlready); |
|
114 |
return; |
|
115 |
} |
|
116 |
||
117 |
iNotifIdPckg() = iUsbNoteNotifier.iNotifId; |
|
118 |
iNotifier.StartNotifierAndGetResponse(iStatus, iUsbNoteNotifier.iCat, |
|
119 |
iNotifIdPckg, iRes); |
|
120 |
SetActive(); |
|
121 |
} |
|
122 |
||
123 |
// --------------------------------------------------------------------------- |
|
124 |
// From base class CActive |
|
125 |
// --------------------------------------------------------------------------- |
|
126 |
// |
|
127 |
void CUsbNoteNotifier::CNotifierActive::RunL() |
|
128 |
{ |
|
129 |
LOG_FUNC |
|
130 |
||
131 |
LOG1( "iStatus = %d" , iStatus.Int()); |
|
132 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
133 |
// if iStatus contains some other than KErrNone code |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
134 |
// do not perform any special actions, |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
135 |
// just forward the error code to caller |
35 | 136 |
|
137 |
iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); |
|
138 |
||
139 |
// report to owner that show is over |
|
140 |
iUsbNoteNotifier.iNotifManager.NotifierShowCompletedL(iUsbNoteNotifier, |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
141 |
iStatus.Int(), iRes()); |
35 | 142 |
} |
143 |
||
144 |
// --------------------------------------------------------------------------- |
|
145 |
// From base class CActive |
|
146 |
// --------------------------------------------------------------------------- |
|
147 |
// |
|
148 |
void CUsbNoteNotifier::CNotifierActive::DoCancel() |
|
149 |
{ |
|
150 |
iNotifier.CancelNotifier(iUsbNoteNotifier.iCat); |
|
151 |
} |
|
152 |
||
153 |
// --------------------------------------------------------------------------- |
|
154 |
// From base class CActive |
|
155 |
// --------------------------------------------------------------------------- |
|
156 |
// |
|
157 |
TInt CUsbNoteNotifier::CNotifierActive::RunError(TInt aError) |
|
158 |
{ |
|
159 |
LOG_FUNC |
|
160 |
||
161 |
LOG1("aError = %d" , aError); |
|
162 |
||
163 |
// try to continue |
|
164 |
return KErrNone; |
|
165 |
} |
|
166 |
||
167 |
// End of file |