author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:44:03 +0100 | |
branch | GCC_SURGE |
changeset 63 | ef2686f7597e |
parent 31 | dfdd8240f7c8 |
parent 56 | f45583a69686 |
permissions | -rw-r--r-- |
35 | 1 |
/* |
56
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
2 |
* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
35 | 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: USB Cable Connected notifier class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
// INCLUDE FILES |
|
18 |
#include <utf.h> // Unicode character conversion utilities |
|
19 |
#include <usbman.h> |
|
20 |
#include <centralrepository.h> |
|
21 |
#include <e32property.h> |
|
22 |
#include <e32uid.h> // KExecutableImageUid |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
23 |
#include <hb/hbwidgets/hbdevicenotificationdialogsymbian.h> |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
24 |
#include <hb/hbcore/hbtextresolversymbian.h> |
35 | 25 |
#include "usbuincableconnectednotifier.h" // Own class definition |
26 |
#include "usbuinotifdebug.h" // Debugging macros |
|
27 |
#include "UsbWatcherInternalCRKeys.h" |
|
28 |
#include "usbuinotif.hrh" |
|
29 |
||
30 |
// Literals |
|
31 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
32 |
_LIT(KUSBExe, "USBSettingsApp"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
33 |
const TInt KUSBUIUid = 0x2002E70C; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
34 |
const TInt KTextIdLength = 40; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
35 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
36 |
_LIT(KUSBUIconFileName, "qtg_large_usb"); |
35 | 37 |
|
38 |
// ================= MEMBER FUNCTIONS ========================================= |
|
39 |
||
40 |
// ---------------------------------------------------------------------------- |
|
41 |
// CUSBUICableConnectedNotifier::NewL |
|
42 |
// Two-phased constructor. |
|
43 |
// ---------------------------------------------------------------------------- |
|
44 |
// |
|
45 |
CUSBUICableConnectedNotifier* CUSBUICableConnectedNotifier::NewL() |
|
46 |
{ |
|
47 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NewL")); |
|
48 |
CUSBUICableConnectedNotifier* self = |
|
49 |
new (ELeave) CUSBUICableConnectedNotifier(); |
|
50 |
CleanupStack::PushL(self); |
|
51 |
self->ConstructL(); |
|
52 |
CleanupStack::Pop(self); |
|
53 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NewL completed")); |
|
54 |
return self; |
|
55 |
} |
|
56 |
||
57 |
// ---------------------------------------------------------------------------- |
|
58 |
// CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier |
|
59 |
// C++ default constructor can NOT contain any code, that |
|
60 |
// might leave. |
|
61 |
// ---------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
CUSBUICableConnectedNotifier::CUSBUICableConnectedNotifier() |
|
64 |
{ |
|
65 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::default constructor")); |
|
66 |
} |
|
67 |
||
68 |
// ---------------------------------------------------------------------------- |
|
69 |
// Destructor |
|
70 |
// ---------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
CUSBUICableConnectedNotifier::~CUSBUICableConnectedNotifier() |
|
73 |
{ |
|
74 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor")); |
|
75 |
//Make sure that the request is completed. Note that inside the destructor, |
|
76 |
//this virtual function call is to the local CUSBUICableConnectedNotifier:: |
|
77 |
//Cancel, not to any possibly derived class implementation. |
|
78 |
Cancel(); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
79 |
|
35 | 80 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::destructor completed")); |
81 |
} |
|
82 |
||
83 |
// ---------------------------------------------------------------------------- |
|
84 |
// CUSBUICableConnectedNotifier::RegisterL |
|
85 |
// Register notifier. |
|
86 |
// ---------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
CUSBUICableConnectedNotifier::TNotifierInfo CUSBUICableConnectedNotifier::RegisterL() |
|
89 |
{ |
|
90 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RegisterL")); |
|
91 |
iInfo.iUid = KCableConnectedNotifierUid; |
|
92 |
iInfo.iChannel = KQueriesNotifier; // work in the same channel with the other |
|
93 |
// queries so that we can use priorities |
|
94 |
iInfo.iPriority = ENotifierPriorityLow; // must be smaller than queries notifier |
|
95 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::RegisterL completed")); |
|
96 |
return iInfo; |
|
97 |
} |
|
98 |
||
99 |
// ---------------------------------------------------------------------------- |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
100 |
// CUSBUICableConnectedNotifier::StartDialogL |
35 | 101 |
// ---------------------------------------------------------------------------- |
102 |
// |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
103 |
void CUSBUICableConnectedNotifier::StartDialogL(const TDesC8& /*aBuffer*/, |
35 | 104 |
TInt aReplySlot, const RMessagePtr2& aMessage) |
105 |
{ |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
106 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL")); |
35 | 107 |
if ( iReplySlot != 0 || iNeedToCompleteMessage) |
108 |
{ |
|
109 |
User::Leave(KErrInUse); |
|
110 |
} |
|
111 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
112 |
InitializeTextResolver(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
113 |
|
35 | 114 |
iMessage = aMessage; |
115 |
iNeedToCompleteMessage = ETrue; |
|
116 |
iReplySlot = aReplySlot; |
|
56
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
117 |
if (iDialog) |
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
118 |
{ |
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
119 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL() deleting previous dialog")); |
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
120 |
delete iDialog; |
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
121 |
iDialog = NULL; |
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
122 |
} |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
123 |
iDialog = CHbDeviceNotificationDialogSymbian::NewL(this); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
124 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
125 |
HBufC* header = NULL; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
126 |
HBufC* description =NULL; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
127 |
GetPersonalityStringLC(header, description); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
128 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
129 |
iDialog->SetTitleL(*header); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
130 |
iDialog->SetTextL(*description); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
131 |
iDialog->SetIconNameL(KUSBUIconFileName ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
132 |
iDialog->EnableTouchActivation(ETrue); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
133 |
iDialog->ShowL(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
134 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
135 |
CleanupStack::PopAndDestroy(header); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
136 |
CleanupStack::PopAndDestroy(description); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
137 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::StartDialogL completed")); |
35 | 138 |
} |
139 |
||
140 |
// ---------------------------------------------------------------------------- |
|
141 |
// CUSBUICableConnectedNotifier::Cancel() |
|
142 |
// Release all own resources (member variables) |
|
143 |
// ---------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
void CUSBUICableConnectedNotifier::Cancel() |
|
146 |
{ |
|
147 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() ")); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
148 |
if (iDialog) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
149 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
150 |
iDialog->Close(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
151 |
delete iDialog; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
152 |
iDialog = NULL; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
153 |
} |
35 | 154 |
CompleteMessage(KErrCancel); |
155 |
CUSBUINotifierBase::Cancel(); |
|
156 |
||
157 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::Cancel() completed")); |
|
158 |
} |
|
159 |
||
160 |
// ----------------------------------------------------------------------------------------------------------- |
|
161 |
// CUSBUICableConnectedNotifier::GetPersonalityStringL |
|
56
f45583a69686
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
162 |
// Get the strings for the discreet popup dialog |
35 | 163 |
// ----------------------------------------------------------------------------------------------------------- |
164 |
// |
|
165 |
void CUSBUICableConnectedNotifier::GetPersonalityStringLC( |
|
166 |
HBufC*& aHeader,HBufC*& aDescription ) |
|
167 |
{ |
|
168 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL")); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
169 |
_LIT(KFixedPart, "txt_usb_dpinfo_"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
170 |
_LIT(KSpace, " "); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
171 |
_LIT(KUnderline, "_"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
172 |
_LIT(KUsbConnected, "txt_usb_dpophead_usb_connected"); |
35 | 173 |
TInt CurrentPersonalityID = 0; // The ID of current USB mode |
174 |
GetCurrentIdL(CurrentPersonalityID); |
|
175 |
RUsb usbman; |
|
176 |
User::LeaveIfError(usbman.Connect()); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
177 |
FLOG(_L("[USBUINOTIF]\t usbman connect called")); |
35 | 178 |
CleanupClosePushL(usbman); |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
179 |
HBufC* description = NULL; |
35 | 180 |
User::LeaveIfError(usbman.GetDescription(CurrentPersonalityID, |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
181 |
description)); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
182 |
FLOG(_L("[USBUINOTIF]\t get description called")); |
35 | 183 |
CleanupStack::PopAndDestroy(&usbman); |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
184 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
185 |
CleanupStack::PushL(description); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
186 |
TPtr descriptionPtr = description->Des(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
187 |
TInt position = descriptionPtr.Find(KSpace); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
188 |
while (position != KErrNotFound) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
189 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
190 |
descriptionPtr.Replace(position, 1, KUnderline); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
191 |
position = descriptionPtr.Find(KSpace); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
192 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
193 |
HBufC* textId = HBufC::NewL( KTextIdLength ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
194 |
CleanupStack::PushL(textId); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
195 |
TPtr textIdPtr = textId->Des(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
196 |
textIdPtr.Append(KFixedPart); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
197 |
textIdPtr.Append(descriptionPtr); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
198 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
199 |
aDescription = HbTextResolverSymbian::LoadL(textIdPtr); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
200 |
CleanupStack::PopAndDestroy(textId); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
201 |
CleanupStack::PopAndDestroy(description); |
35 | 202 |
CleanupStack::PushL(aDescription); |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
203 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
204 |
FLOG(_L("[USBUINOTIF]\t get description called")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
205 |
aHeader = HbTextResolverSymbian::LoadL(KUsbConnected); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
206 |
FLOG(_L("[USBUINOTIF]\t get header called")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
207 |
|
35 | 208 |
CleanupStack::PushL(aHeader); |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
209 |
|
35 | 210 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetPersonalityStringL completed")); |
211 |
} |
|
212 |
||
213 |
// ---------------------------------------------------------------------------- |
|
214 |
// CUSBUICableConnectedNotifier::GetCurrentIdL |
|
215 |
// get the current personality id |
|
216 |
// ---------------------------------------------------------------------------- |
|
217 |
// |
|
218 |
void CUSBUICableConnectedNotifier::GetCurrentIdL(TInt& aCurrentPersonality) |
|
219 |
{ |
|
220 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL")); |
|
221 |
// Connecting and initialization: |
|
222 |
CRepository* repository = CRepository::NewL(KCRUidUsbWatcher); |
|
223 |
CleanupStack::PushL(repository); |
|
224 |
// Get the current USB mode |
|
225 |
TInt ret = repository->Get(KUsbWatcherPersonality, aCurrentPersonality); |
|
226 |
FTRACE( FPrint( |
|
227 |
_L( "[USBWATCHER]\t CUSBUICableConnectedNotifier::GetCurrentIdL() ret = %d" ), |
|
228 |
ret ) ); |
|
229 |
CleanupStack::PopAndDestroy(repository); |
|
230 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::GetCurrentIdL completed")); |
|
231 |
} |
|
232 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
233 |
|
35 | 234 |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
235 |
void CUSBUICableConnectedNotifier::NotificationDialogActivated( |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
236 |
const CHbDeviceNotificationDialogSymbian* /*aDialog*/) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
237 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
238 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
239 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogActivated()")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
240 |
TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00), |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
241 |
TUid::Uid(KUSBUIUid)); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
242 |
iDialog->Close(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
243 |
LaunchApplication(KUSBExe(), uidtype); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
244 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
245 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
246 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
247 |
void CUSBUICableConnectedNotifier::NotificationDialogClosed( |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
248 |
const CHbDeviceNotificationDialogSymbian* /*aDialog*/, TInt /*aCompletionCode*/) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
249 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
250 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogClosed()")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
251 |
CompleteMessage( KErrCancel ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
252 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::NotificationDialogClosed() complete")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
253 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
254 |
} |
35 | 255 |
// --------------------------------------------------------------------------- |
256 |
// CUSBUICableConnectedNotifier::LaunchApplication() |
|
257 |
// launches the application |
|
258 |
// --------------------------------------------------------------------------- |
|
259 |
// |
|
260 |
void CUSBUICableConnectedNotifier::LaunchApplication(const TDesC & aProcessName, |
|
261 |
const TUidType & aUidType) const |
|
262 |
{ |
|
263 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication()")); |
|
264 |
RProcess usbUiProcess; |
|
265 |
TInt result = usbUiProcess.Create(aProcessName, KNullDesC, aUidType); |
|
266 |
FTRACE( FPrint( |
|
267 |
_L( "[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() result = %d" ), |
|
268 |
result ) ); |
|
269 |
usbUiProcess.Resume(); |
|
270 |
usbUiProcess.Close(); |
|
271 |
FLOG(_L("[USBUINOTIF]\t CUSBUICableConnectedNotifier::LaunchApplication() completed")); |
|
272 |
} |
|
273 |
||
274 |
// End of File |