|
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 |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef CONNECTIONSERVPARAMETERBUNDLETRACEIMPL_H |
|
23 #define CONNECTIONSERVPARAMETERBUNDLETRACEIMPL_H |
|
24 |
|
25 #ifdef __CFLOG_ACTIVE |
|
26 |
|
27 // Implementation of functions declared in es_connectionservparameterbundletrace.h |
|
28 |
|
29 #define __PULL_IN_BUNDLE_TRACE_CODE |
|
30 |
|
31 |
|
32 // t_esock specific kludge to prevent duplicated symbols |
|
33 #ifdef __BUILDING_T_ESOCK |
|
34 #ifdef SYMBIAN_SS_TIER_MANAGER_H |
|
35 #undef __PULL_IN_BUNDLE_TRACE_CODE |
|
36 #endif |
|
37 #endif |
|
38 |
|
39 |
|
40 |
|
41 #ifdef __PULL_IN_BUNDLE_TRACE_CODE |
|
42 |
|
43 #include <comms-infras/ss_log.h> |
|
44 |
|
45 using namespace ConnectionServ; |
|
46 |
|
47 namespace ParameterBundleTrace |
|
48 { |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 void ParamSetToString(const XParameterSetBase *baseSet,TDes8& aBuf) |
|
54 { |
|
55 aBuf.Append(_L8(" {")); |
|
56 if(baseSet->IsTypeOf(Meta::STypeId::CreateSTypeId(KParameterSetTypeUid,Meta::KNetMetaTypeAny))) |
|
57 { |
|
58 const XParameterSet* set = static_cast<const XParameterSet*>(baseSet); |
|
59 |
|
60 // perform des16->des8 conversion and safe bounds checking...: |
|
61 |
|
62 RBuf16 tmp; |
|
63 // length limitation only in place for users of this legacy method |
|
64 const TInt max_supported_length = 256; // characters |
|
65 TRAPD(res,tmp.CreateL(max_supported_length)); |
|
66 if(res == KErrNone) |
|
67 { |
|
68 if(set->AppendPrintableTo(tmp) == KErrNone) |
|
69 { |
|
70 if( tmp.Length() <= aBuf.MaxLength()-aBuf.Length() ) |
|
71 { |
|
72 RBuf8 tmp2; |
|
73 TRAP(res,tmp2.CreateL(tmp.Length())); |
|
74 if(res == KErrNone) |
|
75 { |
|
76 tmp2.Copy(tmp); |
|
77 aBuf.Append(tmp2); |
|
78 tmp2.Close(); |
|
79 } |
|
80 } |
|
81 } |
|
82 tmp.Close(); |
|
83 } |
|
84 } |
|
85 else // no other polymorphic trace.. |
|
86 { |
|
87 aBuf.Append(_L8("????")); |
|
88 } |
|
89 aBuf.Append(_L8("}")); |
|
90 } |
|
91 |
|
92 |
|
93 // deprecated methods for specific types. use the XParameterSet::AppendPrintableTo method instead. |
|
94 void GenericParamsToString(const XParameterSet* aSet,TDes8& aBuf) |
|
95 {ParamSetToString(aSet,aBuf);} |
|
96 void GenericQueryToString(const XParameterSet* aSet,TDes8& aBuf) |
|
97 {ParamSetToString(aSet,aBuf);} |
|
98 void CacheParamsToString(const XParameterSet* aSet,TDes8& aBuf) |
|
99 {ParamSetToString(aSet,aBuf);} |
|
100 void CoreCollectorSharedParametersToString(const XParameterSet* aSet,TDes8& aBuf) |
|
101 {ParamSetToString(aSet,aBuf);} |
|
102 void IpProtoParamsToString(const XParameterSet* aSet,TDes8& aBuf) |
|
103 {ParamSetToString(aSet,aBuf);} |
|
104 void PlaneStatusParamsToString(const XParameterSet* aSet,TDes8& aBuf) |
|
105 {ParamSetToString(aSet,aBuf);} |
|
106 void PlaneStatusQueryToString(const XParameterSet* aSet,TDes8& aBuf) |
|
107 {ParamSetToString(aSet,aBuf);} |
|
108 void WifiParamsToString(const XParameterSet* aSet,TDes8& aBuf) |
|
109 {ParamSetToString(aSet,aBuf);} |
|
110 |
|
111 |
|
112 void ParamSetCtrToString(const CParameterSetContainer* aCtnr,TDes8& aBuf) |
|
113 { |
|
114 aBuf.Append(_L8("Ctnr id: ")); |
|
115 aBuf.AppendNum(aCtnr->Id()); |
|
116 const XParameterSetBase *set; |
|
117 TInt i=0; |
|
118 while(1) |
|
119 { |
|
120 set = aCtnr->GetParameterSet(i++); |
|
121 if(set==NULL)break; |
|
122 |
|
123 ParamSetToString(set,aBuf); |
|
124 } |
|
125 aBuf.Append(_L8("\r\n")); |
|
126 } |
|
127 |
|
128 void ParamSetCtrToLog(const TDesC8& aSubsystem, const TDesC8& aComponent, char* aText, const CParameterSetContainer* aCtnr) |
|
129 { |
|
130 #ifdef __CFLOG_ACTIVE |
|
131 __CFLOG_VAR((aSubsystem,aComponent,_L8("%s Ctnr id: %d:"), aText, aCtnr->Id())); |
|
132 |
|
133 TInt i=0; |
|
134 while(1) |
|
135 { |
|
136 const XParameterSetBase* set = aCtnr->GetParameterSet(i++); |
|
137 if(set==NULL)break; |
|
138 |
|
139 TBuf8<512> buf; |
|
140 buf.Append(_L8(" ")); |
|
141 ParamSetToString(set,buf); |
|
142 __CFLOG_0(aSubsystem,aComponent,buf); |
|
143 } |
|
144 #else |
|
145 // Preventing unused variable warnings. |
|
146 (void)aSubsystem; |
|
147 (void)aComponent; |
|
148 (void)aText; |
|
149 (void)aCtnr; |
|
150 #endif |
|
151 } |
|
152 |
|
153 void BundleToString(const CParameterBundleBase* aBundle,TDes8& aBuf) |
|
154 { |
|
155 if(aBundle==NULL) |
|
156 { |
|
157 aBuf.Append(_L8("Bundle:null\r\n")); |
|
158 return; |
|
159 } |
|
160 aBuf.Append(_L8("Bundle:\r\n")); |
|
161 const CParameterSetContainer* ctnr; |
|
162 TInt i=0; |
|
163 while(1) |
|
164 { |
|
165 ctnr = aBundle->GetParamSetContainer(i++); |
|
166 if(ctnr==NULL)break; |
|
167 |
|
168 ParamSetCtrToString(ctnr,aBuf); |
|
169 } |
|
170 } |
|
171 |
|
172 void BundleToLog(const TDesC8& aSubsystem, const TDesC8& aComponent, char* aText, const CParameterBundleBase* aBundle) |
|
173 { |
|
174 #ifdef __CFLOG_ACTIVE |
|
175 if(aBundle==NULL) |
|
176 { |
|
177 __CFLOG_VAR((aSubsystem,aComponent,_L8("%s Bundle:null"), aText)); |
|
178 return; |
|
179 } |
|
180 __CFLOG_VAR((aSubsystem,aComponent,_L8("%s Bundle:"), aText)); |
|
181 const CParameterSetContainer* ctnr; |
|
182 TInt i=0; |
|
183 while(1) |
|
184 { |
|
185 ctnr = aBundle->GetParamSetContainer(i++); |
|
186 if(ctnr==NULL)break; |
|
187 |
|
188 ParamSetCtrToLog(aSubsystem,aComponent," ",ctnr); |
|
189 } |
|
190 #else |
|
191 // Preventing unused variable warnings. |
|
192 (void)aSubsystem; |
|
193 (void)aComponent; |
|
194 (void)aText; |
|
195 (void)aBundle; |
|
196 #endif |
|
197 } |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 } // namespace ParameterBundleTrace |
|
203 |
|
204 |
|
205 #endif |
|
206 // __PULL_IN_BUNDLE_TRACE_CODE |
|
207 |
|
208 #endif |
|
209 // __CFLOG_ACTIVE |
|
210 |
|
211 #endif |
|
212 // CONNECTIONSERVPARAMETERBUNDLETRACEIMPL_H |
|
213 |