1 /* |
|
2 * Copyright (c) 2003-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 the License "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: Implementation for ECom monitoring class for LIW framework. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #include "liwecommonitor.h" |
|
24 #include "liwcommon.h" |
|
25 #include "liwuids.hrh" |
|
26 #include "liwserviceifbase.h" |
|
27 #include <liwservicehandler.h> |
|
28 |
|
29 // CONSTANTS |
|
30 _LIT8(KContentTag, "<CONTENT>"); |
|
31 _LIT8(KOpaqueTag, "<OPAQUE>"); |
|
32 _LIT8(KLiwMimeTypeAll, "*"); |
|
33 const TInt KMaxCmdLength = 238; |
|
34 const TInt KMaxDataParamSize = 255; |
|
35 |
|
36 CLiwEcomMonitor* CLiwEcomMonitor::NewL(TCallBack& aSynchronizeCallBack) |
|
37 { |
|
38 CLiwEcomMonitor* self = new (ELeave) CLiwEcomMonitor(aSynchronizeCallBack); |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop(self); // self |
|
42 return self; |
|
43 } |
|
44 |
|
45 |
|
46 CLiwEcomMonitor::CLiwEcomMonitor(TCallBack& aSynchronizeCallBack) |
|
47 :CActive(CActive::EPriorityStandard), iSynchronizeCallBack(aSynchronizeCallBack) |
|
48 { |
|
49 } |
|
50 |
|
51 |
|
52 CLiwEcomMonitor::~CLiwEcomMonitor() |
|
53 { |
|
54 Cancel(); |
|
55 iEcomSession.Close(); |
|
56 REComSession::FinalClose(); |
|
57 } |
|
58 |
|
59 |
|
60 void CLiwEcomMonitor::ConstructL() |
|
61 { |
|
62 iEcomSession = REComSession::OpenL(); |
|
63 CActiveScheduler::Add(this); |
|
64 StartMonitoring(); |
|
65 } |
|
66 |
|
67 |
|
68 void CLiwEcomMonitor::RunL() |
|
69 { |
|
70 iSynchronizeCallBack.CallBack(); |
|
71 StartMonitoring(); |
|
72 } |
|
73 |
|
74 |
|
75 |
|
76 void CLiwEcomMonitor::DoCancel() |
|
77 { |
|
78 iEcomSession.CancelNotifyOnChange(iStatus); |
|
79 } |
|
80 |
|
81 |
|
82 void CLiwEcomMonitor::StartMonitoring() |
|
83 { |
|
84 iEcomSession.NotifyOnChange(iStatus); |
|
85 SetActive(); |
|
86 } |
|
87 |
|
88 |
|
89 |
|
90 void CLiwEcomMonitor::ListImplemetationsL(RImplInfoPtrArray& aResult, |
|
91 CLiwCriteriaItem* aItem) const |
|
92 { |
|
93 TEComResolverParams params; |
|
94 |
|
95 TUid resolvUid = { KLiwResolverImplUidValue }; |
|
96 |
|
97 TBuf8<KMaxDataParamSize> dataType; |
|
98 if((aItem->ServiceCmdStr().Length() + aItem->ContentType().Length()) > KMaxCmdLength) |
|
99 { |
|
100 User::Leave( KLiwUnknown ); |
|
101 } |
|
102 dataType.Copy(KContentTag); |
|
103 dataType.Append(aItem->ContentType()); |
|
104 dataType.Append(KOpaqueTag); |
|
105 if (aItem->ServiceCmd() != KLiwCmdAsStr) |
|
106 { |
|
107 dataType.AppendNumUC(aItem->ServiceCmd(), EHex); |
|
108 } |
|
109 else |
|
110 { |
|
111 dataType.Append(aItem->ServiceCmdStr()); |
|
112 } |
|
113 params.SetDataType(dataType); |
|
114 params.SetWildcardMatch(dataType.Find(KLiwMimeTypeAll) != KErrNotFound); |
|
115 |
|
116 iEcomSession.ListImplementationsL(aItem->ServiceClass(), params, resolvUid, aResult); |
|
117 } |
|
118 |
|
119 |
|
120 |
|
121 CLiwServiceIfBase* CLiwEcomMonitor::CreateImplementationL(TUid aImplUid) |
|
122 { |
|
123 TUid dtorKeyId; |
|
124 |
|
125 CLiwServiceIfBase* iface = (CLiwServiceIfBase*)iEcomSession.CreateImplementationL(aImplUid, |
|
126 dtorKeyId); |
|
127 |
|
128 if (iface) |
|
129 { |
|
130 iface->SetDtorKeyId( dtorKeyId ); |
|
131 iface->SetImplementationUid( aImplUid ); |
|
132 } |
|
133 |
|
134 return iface; |
|
135 } |
|
136 |
|
137 // End of file |
|