|
1 /* |
|
2 * Copyright (c) 2008-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "refppnotificationman.h" |
|
24 #include <usb/usblogger.h> |
|
25 #include <usb/hostms/policypluginnotifier.hrh> |
|
26 #include "srvpanic.h" |
|
27 |
|
28 |
|
29 #ifdef __FLOG_ACTIVE |
|
30 _LIT8(KLogComponent, "UsbHostMsmmRefPP"); |
|
31 #endif |
|
32 |
|
33 #ifdef __OVER_DUMMYCOMPONENT__ |
|
34 const TUid KMountPolicyNotifierUid = {0x1028653E}; |
|
35 #else |
|
36 const TUid KMountPolicyNotifierUid = {KUidMountPolicyNotifier}; |
|
37 #endif |
|
38 |
|
39 CMsmmPolicyNotificationManager::~CMsmmPolicyNotificationManager() |
|
40 { |
|
41 LOG_FUNC |
|
42 Cancel(); |
|
43 iErrorQueue.Close(); |
|
44 iNotifier.Close(); |
|
45 } |
|
46 |
|
47 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewL() |
|
48 { |
|
49 LOG_STATIC_FUNC_ENTRY |
|
50 CMsmmPolicyNotificationManager* self = |
|
51 CMsmmPolicyNotificationManager::NewLC(); |
|
52 CleanupStack::Pop(self); |
|
53 |
|
54 return self; |
|
55 } |
|
56 |
|
57 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewLC() |
|
58 { |
|
59 LOG_STATIC_FUNC_ENTRY |
|
60 CMsmmPolicyNotificationManager* self = |
|
61 new (ELeave) CMsmmPolicyNotificationManager(); |
|
62 CleanupStack::PushL(self); |
|
63 self->ConstructL(); |
|
64 |
|
65 return self; |
|
66 } |
|
67 |
|
68 void CMsmmPolicyNotificationManager::SendErrorNotificationL( |
|
69 const THostMsErrData& aErrData) |
|
70 { |
|
71 LOG_FUNC |
|
72 |
|
73 // Print error notification data to log |
|
74 LOGTEXT2(_L("Err:iError = %d"), aErrData.iError); |
|
75 LOGTEXT2(_L("Err:iE32Error = %d"), aErrData.iE32Error); |
|
76 LOGTEXT2(_L("Err:iDriveName = %d"), aErrData.iDriveName); |
|
77 LOGTEXT2(_L("Err:iManufacturerString = %S"), &aErrData.iManufacturerString); |
|
78 LOGTEXT2(_L("Err:iProductString = %S"), &aErrData.iProductString); |
|
79 |
|
80 THostMsErrorDataPckg errPckg = aErrData; |
|
81 iErrorQueue.AppendL(errPckg); |
|
82 if (!IsActive()) |
|
83 { |
|
84 SendNotification(); |
|
85 } |
|
86 } |
|
87 |
|
88 void CMsmmPolicyNotificationManager::RunL() |
|
89 { |
|
90 LOG_FUNC |
|
91 iErrorQueue.Remove(0); |
|
92 if (iErrorQueue.Count() > 0) |
|
93 { |
|
94 SendNotification(); |
|
95 } |
|
96 } |
|
97 |
|
98 void CMsmmPolicyNotificationManager::DoCancel() |
|
99 { |
|
100 LOG_FUNC |
|
101 iErrorQueue.Reset(); |
|
102 iNotifier.CancelNotifier(KMountPolicyNotifierUid); |
|
103 } |
|
104 |
|
105 CMsmmPolicyNotificationManager::CMsmmPolicyNotificationManager(): |
|
106 CActive(EPriorityStandard) |
|
107 { |
|
108 LOG_FUNC |
|
109 CActiveScheduler::Add(this); |
|
110 } |
|
111 |
|
112 void CMsmmPolicyNotificationManager::ConstructL() |
|
113 { |
|
114 LOG_FUNC |
|
115 User::LeaveIfError(iNotifier.Connect()); |
|
116 } |
|
117 |
|
118 void CMsmmPolicyNotificationManager::SendNotification() |
|
119 { |
|
120 LOG_FUNC |
|
121 iNotifier.StartNotifierAndGetResponse( |
|
122 iStatus, KMountPolicyNotifierUid, iErrorQueue[0], iResponse); |
|
123 SetActive(); |
|
124 } |
|
125 |
|
126 // End of file |