110 static const TUint KL2CAPDebugInvalidL2CAPLengthInConnect= 3; //< Set the L2CAP length wrong |
103 static const TUint KL2CAPDebugInvalidL2CAPLengthInConnect= 3; //< Set the L2CAP length wrong |
111 static const TUint KL2CAPDebugInvalidL2CAPLengthInData=4;//< Set the L2CAP length wrong |
104 static const TUint KL2CAPDebugInvalidL2CAPLengthInData=4;//< Set the L2CAP length wrong |
112 |
105 |
113 #ifndef LOGGER_H |
106 #ifndef LOGGER_H |
114 |
107 |
115 _LIT(KLogFile,"btlog0.txt"); |
|
116 const TInt KLogIndexOffset=5; |
|
117 _LIT(KLogDirFullName,"c:\\logs\\bt\\"); |
|
118 _LIT(KLogDir,"BT"); |
|
119 |
|
120 //#define COMMENT SLASH(/) |
|
121 #define COMMENT |
|
122 //#define SLASH(s) /##s |
|
123 #ifndef BLOGGING__ |
|
124 // define empty blogging macro stubs |
|
125 #define BLOGGER COMMENT |
|
126 #define BLOG(layer,verbosity,type,blog_call,cbloggette_type) COMMENT |
|
127 //------- Blogging for BT Qual ------------ |
|
128 #define LLQBLOG(type,blog_call) COMMENT |
|
129 #define L2QBLOG(type,blog_call) COMMENT |
|
130 #define RFQBLOG(type,blog_call) COMMENT |
|
131 //------- Loud Blogging Calls ------------- |
|
132 #define LLLBLOG(type,blog_call) COMMENT |
|
133 #define L2LBLOG(type,blog_call) COMMENT |
|
134 #define RFLBLOG(type,blog_call) COMMENT |
|
135 //------- Generic Blogging calls ---------- |
|
136 #define LLBLOG(verbosity,type,blog_call) COMMENT |
|
137 #define L2BLOG(verbosity,type,blog_call) COMMENT |
|
138 #define RFBLOG(verbosity,type,blog_call) COMMENT |
|
139 #else // define blogging calls |
|
140 #define BLOGGER BTTLS->iBlogger |
|
141 #define BLOG(layer,verbosity,type,blog_call,cbloggette_type) \ |
|
142 { \ |
|
143 CBlogger* pBlog = BLOGGER; \ |
|
144 CBloggette* pBloggette;\ |
|
145 if((pBlog->LoggingMask(layer,verbosity))&(type)) \ |
|
146 { \ |
|
147 pBloggette=(pBlog->GetLayerBloggette(layer)); \ |
|
148 (STATIC_CAST(cbloggette_type*,pBloggette))->blog_call; \ |
|
149 } \ |
|
150 } |
|
151 // the blog_call should look like Log(KMyFormatingLit,var1,var2,varbla); |
|
152 // or L2BLOG(KVerbose,Log(KL2ConnLit, connH, addr)); |
|
153 // or L2BLOG(KVerbose,ConnLog(connH,addr)); |
|
154 //------- Blogging for BT Qual ------------ |
|
155 #define LLQBLOG(type,blog_call) BLOG(KBlogLayerLinkLayer,KBlogVerbosityBTQualLevel,type,blog_call, CLLBloggette) |
|
156 #define L2QBLOG(type,blog_call) BLOG(KBlogLayerL2CAP,KBlogVerbosityBTQualLevel,type,blog_call, CL2Bloggette) |
|
157 #define RFQBLOG(type,blog_call) BLOG(KBlogLayerRFComm,KBlogVerbosityBTQualLevel,type,blog_call, CRFBloggette) |
|
158 //------- Loud Blogging Calls ------------- |
|
159 #define LLLBLOG(type,blog_call) BLOG(KBlogLayerLinkLayer,KBlogVerbosityLoud,type,blog_call,CLLBloggette) |
|
160 #define L2LBLOG(type,blog_call) BLOG(KBlogLayerL2CAP,KBlogVerbosityLoud,type,blog_call, CL2Bloggette) |
|
161 #define RFLBLOG(type,blog_call) BLOG(KBlogLayerRFComm,KBlogVerbosityLoud,type,blog_call, CRFBloggette) |
|
162 //------- Generic Blogging calls ---------- |
|
163 #define LLBLOG(verbosity,type,blog_call) BLOG(KBlogLayerLinkLayer,verbosity,type,blog_call,CLLBloggette) |
|
164 #define L2BLOG(verbosity,type,blog_call) BLOG(KBlogLayerL2CAP,verbosity,type,blog_call,CL2Bloggette) |
|
165 #define RFBLOG(verbosity,type,blog_call) BLOG(KBlogLayerRFComm,verbosity,type,blog_call,CRFBloggette) |
|
166 #endif |
|
167 |
|
168 inline void __BTDEBUGGER() |
108 inline void __BTDEBUGGER() |
169 // needed to call __DEBUGGER inside an __ASSERT |
109 // needed to call __DEBUGGER inside an __ASSERT |
170 { |
110 { |
171 __DEBUGGER() |
111 __DEBUGGER() |
172 } |
112 } |
173 |
113 |
174 #ifdef __FLOGGING__ |
114 #endif // LOGGER_H |
175 #define FLOG(a) {FPrint(a);} |
|
176 #define FTRACE(a) {a;} |
|
177 |
115 |
178 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...) |
|
179 { |
|
180 VA_LIST list; |
|
181 VA_START(list,aFmt); |
|
182 TBuf<32> logFile(KLogFile); |
|
183 #ifdef BLOGGING__ |
|
184 // the Blogger holds the flogging file index since it is pointed by the TLS |
|
185 CBlogger* pBlog = BLOGGER; |
|
186 logFile[KLogIndexOffset]=TText('0'+(TInt)pBlog->GetFloggerInfo()); |
|
187 #else |
|
188 logFile[KLogIndexOffset]=TText('0'+BTTLS->iPort); |
|
189 #endif |
|
190 RFileLogger::WriteFormat(KLogDir, logFile, EFileLoggingModeAppend, aFmt, list); |
|
191 #ifdef MEMTRACE |
|
192 TInt size; |
|
193 User::Heap().AllocSize(size); |
|
194 |
|
195 RFileLogger::WriteFormat(KLogDir, logFile, EFileLoggingModeAppend, _L("Mem usage: %d high: %d"), size, User::Heap().Size()); |
|
196 #endif |
|
197 } |
|
198 |
|
199 inline void FHex(const TUint8* aPtr, TInt aLen) |
|
200 { |
|
201 TBuf<32> logFile(KLogFile); |
|
202 logFile[KLogIndexOffset]=TText('0'+BTTLS->iPort); |
|
203 RFileLogger::HexDump(KLogDir, logFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); |
|
204 } |
|
205 |
|
206 inline void FHex(const TDesC8& aDes) |
|
207 { |
|
208 FHex(aDes.Ptr(), aDes.Length()); |
|
209 } |
|
210 |
|
211 |
|
212 #define SCO_LOG(a) FPrint(a); |
|
213 #define SCO_LOG_2(a, b) FPrint(a, b); |
|
214 #define SCO_LOG_3(a, b, c) FPrint(a, b, c); |
|
215 #define SCO_LOG_4(a, b, c, d) FPrint(a, b, c, d); |
|
216 #define SCO_LOG_5(a, b, c, d, e) FPrint(a, b, c, d, e); |
|
217 #define SCO_LOG_6(a, b, c, d, e, f) FPrint(a, b, c, d, e, f); |
|
218 #define SCO_LOG_ADDR(string, addr) { TBuf<20> addrbuf; addrbuf.Format(_L("%02x:%02x:%02x:%02x:%02x:%02x"), addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); SCO_LOG_2(string, &addrbuf); } |
|
219 |
|
220 #else // i.e. __FLOGGING__ undefined |
|
221 #define FLOG(a) |
|
222 #define FTRACE(a) |
|
223 |
|
224 #define SCO_LOG(a) |
|
225 #define SCO_LOG_2(a, b) |
|
226 #define SCO_LOG_3(a, b, c) |
|
227 #define SCO_LOG_4(a, b, c, d) |
|
228 #define SCO_LOG_5(a, b, c, d, e) |
|
229 #define SCO_LOG_6(a, b, c, d, e, f) |
|
230 #define SCO_LOG_ADDR(string, addr) |
|
231 |
|
232 |
|
233 inline void FPrint(const TRefByValue<const TDesC> /*aFmt*/,...) |
|
234 { |
|
235 #ifdef _DEBUG // to quell linker warnings |
|
236 RFileLogger dummy; |
|
237 #endif |
|
238 } |
|
239 |
|
240 inline void FHex(const TUint8* /*aPtr*/, TInt /*aLen*/) |
|
241 { |
|
242 } |
|
243 |
|
244 inline void FHex(const TDesC8& /*aDes*/) |
|
245 { |
|
246 } |
|
247 |
|
248 #endif // __FLOGGING__ |
|
249 |
|
250 #endif // #ifndef LOGGER_H |
|
251 |
116 |
252 #define __PANIC_UNEXPECTED_CALL __ASSERT_DEBUG(NULL, User::Invariant()); |
117 #define __PANIC_UNEXPECTED_CALL __ASSERT_DEBUG(NULL, User::Invariant()); |
253 |
118 |
254 #endif // __BT_DEBUG_H__ |
119 #endif // __BT_DEBUG_H__ |