|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file connservparams.cpp |
|
18 */ |
|
19 |
|
20 #include <e32std.h> |
|
21 #include <e32test.h> |
|
22 |
|
23 #include <ecom/ecom.h> |
|
24 #include <ecom/implementationproxy.h> |
|
25 #include <comms-infras/metatypearray.h> |
|
26 #include "cs_connservparams.h" |
|
27 #include <comms-infras/cs_connservparams_internal.h> |
|
28 |
|
29 using namespace ConnectionServ; |
|
30 using namespace Meta; |
|
31 |
|
32 START_ATTRIBUTE_TABLE( XAccessPointGenericParameterSet, KConnectionServGenericParamImplUid, KAccessPointGenericParameterSetType ) |
|
33 REGISTER_ATTRIBUTE( XAccessPointGenericParameterSet, iApInfo, TMeta<TAccessPointInfo> ) |
|
34 REGISTER_ATTRIBUTE( XAccessPointGenericParameterSet, iApStatus, TMeta<TAccessPointStatus> ) |
|
35 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
36 |
|
37 START_ATTRIBUTE_TABLE( XAccessPointGenericQuery, KConnectionServGenericParamImplUid, KAccessPointGenericQueryType ) |
|
38 REGISTER_ATTRIBUTE( XAccessPointGenericQuery, iApsToMatch, TMetaArray<TAccessPointInfo> ) |
|
39 REGISTER_ATTRIBUTE( XAccessPointGenericQuery, iApStatusFilter, TMeta<TAccessPointStatusFilter> ) |
|
40 REGISTER_ATTRIBUTE( XAccessPointGenericQuery, iParameterSetTypesToReturn, TMetaArray<STypeId> ) |
|
41 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
42 |
|
43 |
|
44 // Used internally by the notification mechanism. |
|
45 // Contains 2 bit maps. The collector session with index i will mark bit i in each of these, |
|
46 // to denote: |
|
47 // iRunning - whether the collector knows about this access point and must match to allow report of this AP |
|
48 // iReceived - whether the collector has received any data for this access point |
|
49 // iInSet - that the cache entry matches the collector's interpretation of the query filter |
|
50 // iToReport - that the cache entry needs to be reported to the client |
|
51 START_ATTRIBUTE_TABLE( XNotificationCacheParameterSet, KConnectionServGenericParamImplUid, KNotificationCacheParameterSetType ) |
|
52 REGISTER_ATTRIBUTE( XNotificationCacheParameterSet, iRunning, TMeta<TUint32> ) |
|
53 REGISTER_ATTRIBUTE( XNotificationCacheParameterSet, iReceived, TMeta<TUint32> ) |
|
54 REGISTER_ATTRIBUTE( XNotificationCacheParameterSet, iInSet, TMeta<TUint32> ) |
|
55 REGISTER_ATTRIBUTE( XNotificationCacheParameterSet, iToReport, TMeta<TUint32> ) |
|
56 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
57 |
|
58 // Used internally by the notification mechanism between different core data collectors. |
|
59 // To allow the separation of the collector of MCPRs and the collector of data from those MCPRs. |
|
60 // iMcprCommsId - the comms id of the MCPR of this access point.. for passing between collectors |
|
61 // iMcprPtr - pointer to the same MCPR |
|
62 START_ATTRIBUTE_TABLE( XCoreCollectorSharedParameterSet, KConnectionServGenericParamImplUid, KCoreCollectorSharedParameterSetType ) |
|
63 REGISTER_ATTRIBUTE( XCoreCollectorSharedParameterSet, iMcprCommsId, TMeta<Messages::TNodeId> ) |
|
64 REGISTER_ATTRIBUTE( XCoreCollectorSharedParameterSet, iMcprPtr, TMeta<CBase*> ) |
|
65 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
66 |
|
67 // Used internally to contain information about the IP Proto layer by CConnection legacy calls. |
|
68 START_ATTRIBUTE_TABLE( XIpProtoAccessPointParameterSet, KConnectionServGenericParamImplUid, KIpProtoAccessPointParameterSetType ) |
|
69 REGISTER_ATTRIBUTE( XIpProtoAccessPointParameterSet, iIapId, TMeta<TUint32> ) |
|
70 REGISTER_ATTRIBUTE( XIpProtoAccessPointParameterSet, iNetworkId, TMeta<TUint32> ) |
|
71 REGISTER_ATTRIBUTE( XIpProtoAccessPointParameterSet, iConnectionType, TMeta<TUint32> ) |
|
72 REGISTER_ATTRIBUTE( XIpProtoAccessPointParameterSet, iControlClientId, TMeta<Messages::TNodeId> ) |
|
73 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
74 |
|
75 // Only used internally at the moment, by EnumerateConnections |
|
76 START_ATTRIBUTE_TABLE( XAccessPointPlaneStatusParameterSet, KConnectionServGenericParamImplUid, KAccessPointPlaneStatusParameterSetType ) |
|
77 REGISTER_ATTRIBUTE( XAccessPointPlaneStatusParameterSet, iPlaneStatus, TMeta<TAccessPointPlaneStatus> ) |
|
78 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
79 |
|
80 // Only used internally at the moment, by EnumerateConnections |
|
81 START_ATTRIBUTE_TABLE( XAccessPointPlaneStatusQuery, KConnectionServGenericParamImplUid, KAccessPointPlaneStatusQueryType ) |
|
82 REGISTER_ATTRIBUTE( XAccessPointPlaneStatusQuery, iPlaneStatusFilter, TMeta<TAccessPointPlaneStatusFilter> ) |
|
83 END_ATTRIBUTE_TABLE_BASE( XConnectionServParameterSet, 0 ) |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 // Define the interface UIDs |
|
90 const TImplementationProxy ImplementationTable[] = |
|
91 { |
|
92 IMPLEMENTATION_PROXY_ENTRY(KConnectionServGenericParamImplUid, CConnectionServGenericParamsFactory::NewL), |
|
93 }; |
|
94 |
|
95 /** |
|
96 ECOM Implementation Factories |
|
97 */ |
|
98 |
|
99 //extern "C" { IMPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount); } |
|
100 |
|
101 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
102 { |
|
103 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
104 |
|
105 return ImplementationTable; |
|
106 } |
|
107 |
|
108 /** |
|
109 Plugin Implementation |
|
110 */ |
|
111 |
|
112 XConnectionServParameterSet* CConnectionServGenericParamsFactory::NewL(TAny* aConstructionParameters) |
|
113 { |
|
114 TInt32 type = reinterpret_cast<TInt32>(aConstructionParameters); |
|
115 switch (type) |
|
116 { |
|
117 case (KAccessPointGenericParameterSetType): |
|
118 return new (ELeave) XAccessPointGenericParameterSet; |
|
119 case (KAccessPointGenericQueryType): |
|
120 return new (ELeave) XAccessPointGenericQuery; |
|
121 case (KNotificationCacheParameterSetType): |
|
122 return new (ELeave) XNotificationCacheParameterSet; |
|
123 case (KCoreCollectorSharedParameterSetType): |
|
124 return new (ELeave) XCoreCollectorSharedParameterSet; |
|
125 case (KIpProtoAccessPointParameterSetType): |
|
126 return new (ELeave) XIpProtoAccessPointParameterSet; |
|
127 case (KAccessPointPlaneStatusParameterSetType): |
|
128 return new (ELeave) XAccessPointPlaneStatusParameterSet; |
|
129 case (KAccessPointPlaneStatusQueryType): |
|
130 return new (ELeave) XAccessPointPlaneStatusQuery; |
|
131 default: |
|
132 User::Leave(KErrNotFound); |
|
133 } |
|
134 return NULL; |
|
135 } |
|
136 |
|
137 |
|
138 /*virtual*/ void XAccessPointGenericParameterSet::UpdateWithL(const XParameterSet& aRhsBase) |
|
139 { |
|
140 const XAccessPointGenericParameterSet& aRhs = static_cast<const XAccessPointGenericParameterSet&>(aRhsBase); |
|
141 if(aRhs.AccessPointInfo().AccessPoint()) |
|
142 { |
|
143 iApInfo = aRhs.iApInfo; |
|
144 } |
|
145 iApStatus.UpdateWith(aRhs.iApStatus); |
|
146 } |
|
147 |
|
148 /*virtual*/ void XAccessPointGenericParameterSet::CopyFieldsRequiredByQueryFromL( |
|
149 const CParameterBundleBase& aQueryBundle,const XConnectionServParameterSet& aSourceBase) |
|
150 { |
|
151 const XAccessPointGenericParameterSet& aSource = static_cast<const XAccessPointGenericParameterSet&>(aSourceBase); |
|
152 const CParameterSetContainer* aQueryCtr = aQueryBundle.GetParamSetContainer(0); |
|
153 User::LeaveIfNull((TAny*)aQueryCtr); |
|
154 const XAccessPointGenericQuery* aQuerySet = XAccessPointGenericQuery::FindInParamSetContainer(*aQueryCtr); |
|
155 User::LeaveIfNull((TAny*)aQuerySet); |
|
156 iApInfo = aSource.iApInfo; |
|
157 iApStatus.CopyFieldsRequiredByQueryFrom(aQuerySet->AccessPointStatusFilter(),aSource.iApStatus); |
|
158 } |
|
159 |
|
160 /*virtual*/ TInt XAccessPointGenericParameterSet::AppendPrintableTo(TDes& aBuf) const |
|
161 { |
|
162 #ifdef __CFLOG_ACTIVE |
|
163 TDes16IgnoreOverflow ignoreOverflow; |
|
164 TAccessPointInfo inf = this->AccessPointInfo(); |
|
165 TAccessPointStatus stat = this->AccessPointStatus(); |
|
166 aBuf.AppendFormat(_L("GPS: AP:%d C:%c R:%c A:%c S:%c"),&ignoreOverflow, |
|
167 inf.AccessPoint(), |
|
168 TAccessPointStatus::FlagValueAsChar(stat.Configured()), |
|
169 TAccessPointStatus::FlagValueAsChar(stat.Restricted()), |
|
170 TAccessPointStatus::FlagValueAsChar(stat.Available()), |
|
171 TAccessPointStatus::FlagValueAsChar(stat.Started()) ); |
|
172 return KErrNone; |
|
173 #else |
|
174 (void)aBuf; |
|
175 return KErrNotSupported; |
|
176 #endif // __CFLOG_ACTIVE |
|
177 } |
|
178 |
|
179 |
|
180 /*virtual*/ XAccessPointGenericQuery::~XAccessPointGenericQuery() |
|
181 { |
|
182 iApsToMatch.Close(); |
|
183 iParameterSetTypesToReturn.Close(); |
|
184 } |
|
185 |
|
186 TBool CompareTypeIds(const STypeId& aFirst, const STypeId& aSecond) |
|
187 { |
|
188 return( aFirst == aSecond ); |
|
189 } |
|
190 |
|
191 /*virtual*/ TBool XAccessPointGenericQuery::ShouldReturnType(const STypeId& aTypeId) const |
|
192 { |
|
193 return iParameterSetTypesToReturn.Find(aTypeId,TIdentityRelation<STypeId>(CompareTypeIds)) != KErrNotFound ; |
|
194 } |
|
195 |
|
196 /*virtual*/ TInt XAccessPointGenericQuery::AppendPrintableTo(TDes& aBuf) const |
|
197 { |
|
198 #ifdef __CFLOG_ACTIVE |
|
199 TDes16IgnoreOverflow ignoreOverflow; |
|
200 aBuf.AppendFormat(_L("GQ: APs("),&ignoreOverflow); |
|
201 |
|
202 const RArray<TAccessPointInfo>& aps = this->AccessPointsToMatch(); |
|
203 TAccessPointStatusFilter apsf = this->AccessPointStatusFilter(); |
|
204 const RArray<STypeId>& types = this->GetParameterSetTypesToReturn(); |
|
205 |
|
206 TInt i=0; |
|
207 for( ; i<aps.Count(); ++i) |
|
208 { |
|
209 if(i) |
|
210 { |
|
211 aBuf.AppendFormat(_L(","),&ignoreOverflow); |
|
212 } |
|
213 aBuf.AppendFormat(_L("%d"),&ignoreOverflow,aps[i].AccessPoint()); |
|
214 } |
|
215 |
|
216 aBuf.AppendFormat(_L(") C:%c R:%c A:%c S:%c typ("),&ignoreOverflow, |
|
217 TAccessPointStatusFilter::FilterValueAsChar(apsf.Configured()), |
|
218 TAccessPointStatusFilter::FilterValueAsChar(apsf.Restricted()), |
|
219 TAccessPointStatusFilter::FilterValueAsChar(apsf.Available()), |
|
220 TAccessPointStatusFilter::FilterValueAsChar(apsf.Started()) ); |
|
221 |
|
222 for(i=0 ; i<types.Count(); ++i) |
|
223 { |
|
224 if(i) |
|
225 { |
|
226 aBuf.AppendFormat(_L(","),&ignoreOverflow); |
|
227 } |
|
228 aBuf.AppendFormat(_L("%S-%08x)"),&ignoreOverflow, |
|
229 types[i].iUid.iUid, |
|
230 types[i].iType ); |
|
231 } |
|
232 return KErrNone; |
|
233 #else |
|
234 (void)aBuf; |
|
235 return KErrNotSupported; |
|
236 #endif // __CFLOG_ACTIVE |
|
237 } |
|
238 |
|
239 |
|
240 /*virtual*/ TInt XNotificationCacheParameterSet::AppendPrintableTo(TDes& aBuf) const |
|
241 { |
|
242 #ifdef __CFLOG_ACTIVE |
|
243 TDes16IgnoreOverflow ignoreOverflow; |
|
244 aBuf.AppendFormat(_L("NCP: Rg%032b Rd%032b IS%032b TR%032b"),&ignoreOverflow, |
|
245 this->RunningValue(), |
|
246 this->ReceivedValue(), |
|
247 this->InSetValue(), |
|
248 this->ToReportValue() ); |
|
249 return KErrNone; |
|
250 #else |
|
251 (void)aBuf; |
|
252 return KErrNotSupported; |
|
253 #endif // __CFLOG_ACTIVE |
|
254 } |
|
255 |
|
256 |
|
257 /*virtual*/ void XCoreCollectorSharedParameterSet::UpdateWithL(const XParameterSet& aRhsBase) |
|
258 { |
|
259 const XCoreCollectorSharedParameterSet& aRhs = static_cast<const XCoreCollectorSharedParameterSet&>(aRhsBase); |
|
260 |
|
261 if(aRhs.iMcprPtr) |
|
262 { |
|
263 iMcprPtr=aRhs.iMcprPtr; |
|
264 iMcprCommsId=aRhs.iMcprCommsId; |
|
265 } |
|
266 } |
|
267 |
|
268 /*virtual*/ TInt XCoreCollectorSharedParameterSet::AppendPrintableTo(TDes& aBuf) const |
|
269 { |
|
270 #ifdef __CFLOG_ACTIVE |
|
271 TDes16IgnoreOverflow ignoreOverflow; |
|
272 aBuf.AppendFormat(_L("CCSPS:mcpr %08x"),&ignoreOverflow, |
|
273 reinterpret_cast<TUint32>(this->McprPtr()) ); |
|
274 return KErrNone; |
|
275 #else |
|
276 (void)aBuf; |
|
277 return KErrNotSupported; |
|
278 #endif // __CFLOG_ACTIVE |
|
279 } |
|
280 |
|
281 |
|
282 /*virtual*/ void XIpProtoAccessPointParameterSet::UpdateWithL(const XParameterSet& aRhsBase) |
|
283 { |
|
284 const XIpProtoAccessPointParameterSet& aRhs = static_cast<const XIpProtoAccessPointParameterSet&>(aRhsBase); |
|
285 |
|
286 iIapId = aRhs.iIapId; |
|
287 iNetworkId = aRhs.iNetworkId; |
|
288 iConnectionType = aRhs.iConnectionType; |
|
289 iControlClientId = aRhs.iControlClientId; |
|
290 } |
|
291 |
|
292 /*virtual*/ TInt XIpProtoAccessPointParameterSet::AppendPrintableTo(TDes& aBuf) const |
|
293 { |
|
294 #ifdef __CFLOG_ACTIVE |
|
295 TDes16IgnoreOverflow ignoreOverflow; |
|
296 aBuf.AppendFormat(_L("IPPAPS:IAP:%d Net:%d ConnType:%d"),&ignoreOverflow, |
|
297 this->IapId(), |
|
298 this->NetworkId(), |
|
299 this->ConnectionType() ); |
|
300 return KErrNone; |
|
301 #else |
|
302 (void)aBuf; |
|
303 return KErrNotSupported; |
|
304 #endif // __CFLOG_ACTIVE |
|
305 } |
|
306 |
|
307 |
|
308 /*virtual*/ void XAccessPointPlaneStatusParameterSet::UpdateWithL(const XParameterSet& aRhsBase) |
|
309 { |
|
310 const XAccessPointPlaneStatusParameterSet& aRhs = static_cast<const XAccessPointPlaneStatusParameterSet&>(aRhsBase); |
|
311 iPlaneStatus.UpdateWithL(aRhs.iPlaneStatus); |
|
312 } |
|
313 |
|
314 /*virtual*/ void XAccessPointPlaneStatusParameterSet::CopyFieldsRequiredByQueryFromL( |
|
315 const CParameterBundleBase& aQueryBundle,const XConnectionServParameterSet& aSourceBase) |
|
316 { |
|
317 const XAccessPointPlaneStatusParameterSet& aSource = static_cast<const XAccessPointPlaneStatusParameterSet&>(aSourceBase); |
|
318 const CParameterSetContainer* aQueryCtr = aQueryBundle.GetParamSetContainer(0); |
|
319 User::LeaveIfNull((TAny*)aQueryCtr); |
|
320 const XAccessPointPlaneStatusQuery* aQuerySet = XAccessPointPlaneStatusQuery::FindInParamSetContainer(*aQueryCtr); |
|
321 User::LeaveIfNull((TAny*)aQuerySet); |
|
322 |
|
323 iPlaneStatus.CopyFieldsRequiredByQueryFrom(aQuerySet->PlaneStatusFilter(),aSource.iPlaneStatus); |
|
324 } |
|
325 |
|
326 /*virtual*/ TInt XAccessPointPlaneStatusParameterSet::AppendPrintableTo(TDes& aBuf) const |
|
327 { |
|
328 #ifdef __CFLOG_ACTIVE |
|
329 TDes16IgnoreOverflow ignoreOverflow; |
|
330 const TAccessPointPlaneStatus& ps = this->PlaneStatus(); |
|
331 aBuf.AppendFormat(_L("PlSt:T..M..C%c.S..F.."),&ignoreOverflow, |
|
332 TAccessPointStatus::FlagValueAsChar(ps.Connection_Exists())); |
|
333 return KErrNone; |
|
334 #else |
|
335 (void)aBuf; |
|
336 return KErrNotSupported; |
|
337 #endif // __CFLOG_ACTIVE |
|
338 } |
|
339 |
|
340 /*virtual*/ TInt XAccessPointPlaneStatusQuery::AppendPrintableTo(TDes& aBuf) const |
|
341 { |
|
342 #ifdef __CFLOG_ACTIVE |
|
343 TDes16IgnoreOverflow ignoreOverflow; |
|
344 const TAccessPointPlaneStatusFilter& psf = this->PlaneStatusFilter(); |
|
345 aBuf.AppendFormat(_L("PlSt:T..M..C%c.S..F.."),&ignoreOverflow, |
|
346 TAccessPointStatusFilter::FilterValueAsChar(psf.Connection_Exists())); |
|
347 return KErrNone; |
|
348 #else |
|
349 (void)aBuf; |
|
350 return KErrNotSupported; |
|
351 #endif // __CFLOG_ACTIVE |
|
352 } |
|
353 |
|
354 |