Commit 2fb4b729efb278b6b7869dbc508f29d58fae67a0

Authored by Hu Chunming
1 parent c3c38c3c

修复日志编码问题

src/decoder/gb28181/sip/Message/CatalogParser.cpp
... ... @@ -30,7 +30,7 @@ bool CCatalogParser::Encode( std::string &message )
30 30  
31 31 for( auto it = m_devices.begin(); it != m_devices.end(); ++it )
32 32 {
33   - // У��Ŀ¼��ı�ѡ����
  33 + // 校验目录项的必选参数
34 34 const DeviceInfo &catalog = (*it);
35 35 content<<"<Item>\r\n";
36 36 content<<"<DeviceID>"<<catalog.id<<"</DeviceID>\r\n";
... ... @@ -173,7 +173,7 @@ bool CCatalogParser::Encode( std::string &amp;message )
173 173 std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::XMLNode* > &nodes)
174 174 {
175 175 std::vector< DeviceInfo > cat_list;
176   - // �������У��
  176 + // 必须参数校验
177 177 tinyxml2::XMLNode *pSumNum = NULL;
178 178 size_t size = nodes.size();
179 179 for( size_t i = 0; i < size; ++i )
... ... @@ -181,14 +181,14 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
181 181 tinyxml2::XMLNode *pNode = nodes[i];
182 182 if( pNode == NULL )
183 183 {
184   - LOG_DEBUG( "��������" );
  184 + LOG_DEBUG( "参数错误" );
185 185 continue;
186 186 }
187 187  
188 188 const char* type = pNode->Value();
189 189 if( type == NULL )
190 190 {
191   - LOG_DEBUG( "��������Ϊ��" );
  191 + LOG_DEBUG( "参数名字为空" );
192 192 continue;
193 193 }
194 194  
... ... @@ -198,28 +198,28 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
198 198 }
199 199 }
200 200  
201   - // ��ѡ����������
  201 + // 必选参数必须填
202 202 if( pSumNum == NULL )
203 203 {
204   - LOG_ERROR( "����SumNumû�б�����" );
  204 + LOG_ERROR( "参数SumNum没有被设置" );
205 205 return cat_list;
206 206 }
207 207  
208   - // ��������
  208 + // 参数解析
209 209 std::list< tinyxml2::XMLNode* > items;
210 210 for( size_t i = 0; i < size; ++i )
211 211 {
212 212 tinyxml2::XMLNode *pNode = nodes[i];
213 213 if( pNode == NULL )
214 214 {
215   - LOG_DEBUG( "��������" );
  215 + LOG_DEBUG( "参数错误" );
216 216 continue;
217 217 }
218 218  
219 219 const char* type = pNode->Value();
220 220 if( type == NULL )
221 221 {
222   - LOG_DEBUG( "��������Ϊ��" );
  222 + LOG_DEBUG( "参数名字为空" );
223 223 continue;
224 224 }
225 225  
... ... @@ -228,14 +228,14 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
228 228 tinyxml2::XMLNode *pChild = pNode->FirstChild();
229 229 if( pChild == NULL )
230 230 {
231   - LOG_DEBUG( "����ֵû������" );
  231 + LOG_DEBUG( "参数值没有设置" );
232 232 continue;
233 233 }
234 234  
235 235 const char *value = pChild->Value();
236 236 if( value == NULL )
237 237 {
238   - LOG_DEBUG( "����ֵΪ��" );
  238 + LOG_DEBUG( "参数值为空" );
239 239 continue;
240 240 }
241 241 else
... ... @@ -248,14 +248,14 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
248 248 tinyxml2::XMLNode *pChild = pNode->FirstChild();
249 249 if( pChild == NULL )
250 250 {
251   - LOG_DEBUG( "����ֵû������" );
  251 + LOG_DEBUG( "参数值没有设置" );
252 252 continue;
253 253 }
254 254  
255 255 const char *value = pChild->Value();
256 256 if( value == NULL )
257 257 {
258   - LOG_DEBUG( "����ֵΪ��" );
  258 + LOG_DEBUG( "参数值为空" );
259 259 continue;
260 260 }
261 261 else
... ... @@ -270,7 +270,7 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
270 270 const char *type = pItem->Value();
271 271 if( type == NULL )
272 272 {
273   - LOG_DEBUG( "��������Ϊ��" );
  273 + LOG_DEBUG( "参数名字为空" );
274 274 continue;
275 275 }
276 276  
... ... @@ -280,19 +280,19 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
280 280 }
281 281 else
282 282 {
283   - LOG_DEBUG( "����δ����IJ���:{}" , type );
  283 + LOG_DEBUG( "国标未定义的参数:{}" , type );
284 284 continue;
285 285 }
286 286 }
287 287 }
288 288 else
289 289 {
290   - LOG_DEBUG( "����δ����IJ���:{}" , type );
  290 + LOG_DEBUG( "国标未定义的参数:{}" , type );
291 291 continue;
292 292 }
293 293 }
294 294  
295   - // Ŀ¼��
  295 + // 目录项
296 296 std::list< tinyxml2::XMLNode* >::iterator it = items.begin();
297 297 std::list< tinyxml2::XMLNode* >::iterator end = items.end();
298 298 for( /*it*/; it != end; ++it )
... ... @@ -303,21 +303,21 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
303 303 const char *type = pItem->Value();
304 304 if( type == NULL )
305 305 {
306   - LOG_DEBUG( "��������Ϊ��" );
  306 + LOG_DEBUG( "参数名字为空" );
307 307 continue;
308 308 }
309 309  
310 310 tinyxml2::XMLNode *pValue = pItem->FirstChild();
311 311 if( pValue == NULL )
312 312 {
313   - LOG_DEBUG( "����ֵû������" );
  313 + LOG_DEBUG( "参数值没有设置" );
314 314 continue;
315 315 }
316 316  
317 317 const char *value = pValue->Value();
318 318 if( value == NULL )
319 319 {
320   - LOG_DEBUG( "����ֵΪ��" );
  320 + LOG_DEBUG( "参数值为空" );
321 321 continue;
322 322 }
323 323  
... ... @@ -357,7 +357,7 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
357 357 }
358 358 else
359 359 {
360   - LOG_ERROR( "Event����ֵ\'{}\'��Ч", value );
  360 + LOG_ERROR( "Event参数值\'{}\'无效", value );
361 361 return cat_list;
362 362 }
363 363 }
... ... @@ -488,21 +488,21 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
488 488 pValue = pInfo->FirstChild();
489 489 if( pValue == NULL )
490 490 {
491   - LOG_DEBUG( "����ֵû������" );
  491 + LOG_DEBUG( "参数值没有设置" );
492 492 continue;
493 493 }
494 494  
495 495 const char *type = pInfo->Value();
496 496 if( type == NULL )
497 497 {
498   - LOG_DEBUG( "��������Ϊ��" );
  498 + LOG_DEBUG( "参数名字为空" );
499 499 continue;
500 500 }
501 501  
502 502 const char *value = pValue->Value();
503 503 if( value == NULL )
504 504 {
505   - LOG_DEBUG( "����ֵΪ��" );
  505 + LOG_DEBUG( "参数值为空" );
506 506 continue;
507 507 }
508 508  
... ... @@ -540,13 +540,13 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode( const std::vector&lt; tinyxml2::X
540 540 }
541 541 else
542 542 {
543   - LOG_DEBUG( "����δ����IJ���:{}" , type );
  543 + LOG_DEBUG( "国标未定义的参数:{}" , type );
544 544 }
545 545 }
546 546 }
547 547 else
548 548 {
549   - LOG_DEBUG( "����δ����IJ���:{}" , type );
  549 + LOG_DEBUG( "国标未定义的参数:{}" , type );
550 550 }
551 551 }
552 552  
... ... @@ -622,10 +622,9 @@ std::vector&lt; DeviceInfo &gt; CCatalogParser::Decode_Catlog(const char* body)
622 622 cat_list = Decode(nodes);
623 623 if (cat_list.empty())
624 624 {
625   - LOG_ERROR("��Ϣ���������!");
  625 + LOG_ERROR("消息体解析错误!");
626 626 }
627 627 }
628 628  
629   -
630 629 return cat_list;
631 630 }
632 631 \ No newline at end of file
... ...