diff --git a/src/decoder/gb28181/sip/Message/CatalogParser.cpp b/src/decoder/gb28181/sip/Message/CatalogParser.cpp index 93ff097..d3129f8 100644 --- a/src/decoder/gb28181/sip/Message/CatalogParser.cpp +++ b/src/decoder/gb28181/sip/Message/CatalogParser.cpp @@ -30,7 +30,7 @@ bool CCatalogParser::Encode( std::string &message ) for( auto it = m_devices.begin(); it != m_devices.end(); ++it ) { - // У��Ŀ¼��ı�ѡ���� + // 校验目录项的必选参数 const DeviceInfo &catalog = (*it); content<<"\r\n"; content<<""<\r\n"; @@ -173,7 +173,7 @@ bool CCatalogParser::Encode( std::string &message ) std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::XMLNode* > &nodes) { std::vector< DeviceInfo > cat_list; - // �������У�� + // 必须参数校验 tinyxml2::XMLNode *pSumNum = NULL; size_t size = nodes.size(); for( size_t i = 0; i < size; ++i ) @@ -181,14 +181,14 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X tinyxml2::XMLNode *pNode = nodes[i]; if( pNode == NULL ) { - LOG_DEBUG( "��������" ); + LOG_DEBUG( "参数错误" ); continue; } const char* type = pNode->Value(); if( type == NULL ) { - LOG_DEBUG( "��������Ϊ��" ); + LOG_DEBUG( "参数名字为空" ); continue; } @@ -198,28 +198,28 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X } } - // ��ѡ���������� + // 必选参数必须填 if( pSumNum == NULL ) { - LOG_ERROR( "����SumNumû�б�����" ); + LOG_ERROR( "参数SumNum没有被设置" ); return cat_list; } - // �������� + // 参数解析 std::list< tinyxml2::XMLNode* > items; for( size_t i = 0; i < size; ++i ) { tinyxml2::XMLNode *pNode = nodes[i]; if( pNode == NULL ) { - LOG_DEBUG( "��������" ); + LOG_DEBUG( "参数错误" ); continue; } const char* type = pNode->Value(); if( type == NULL ) { - LOG_DEBUG( "��������Ϊ��" ); + LOG_DEBUG( "参数名字为空" ); continue; } @@ -228,14 +228,14 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X tinyxml2::XMLNode *pChild = pNode->FirstChild(); if( pChild == NULL ) { - LOG_DEBUG( "����ֵû������" ); + LOG_DEBUG( "参数值没有设置" ); continue; } const char *value = pChild->Value(); if( value == NULL ) { - LOG_DEBUG( "����ֵΪ��" ); + LOG_DEBUG( "参数值为空" ); continue; } else @@ -248,14 +248,14 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X tinyxml2::XMLNode *pChild = pNode->FirstChild(); if( pChild == NULL ) { - LOG_DEBUG( "����ֵû������" ); + LOG_DEBUG( "参数值没有设置" ); continue; } const char *value = pChild->Value(); if( value == NULL ) { - LOG_DEBUG( "����ֵΪ��" ); + LOG_DEBUG( "参数值为空" ); continue; } else @@ -270,7 +270,7 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X const char *type = pItem->Value(); if( type == NULL ) { - LOG_DEBUG( "��������Ϊ��" ); + LOG_DEBUG( "参数名字为空" ); continue; } @@ -280,19 +280,19 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X } else { - LOG_DEBUG( "����δ����IJ���:{}" , type ); + LOG_DEBUG( "国标未定义的参数:{}" , type ); continue; } } } else { - LOG_DEBUG( "����δ����IJ���:{}" , type ); + LOG_DEBUG( "国标未定义的参数:{}" , type ); continue; } } - // Ŀ¼�� + // 目录项 std::list< tinyxml2::XMLNode* >::iterator it = items.begin(); std::list< tinyxml2::XMLNode* >::iterator end = items.end(); for( /*it*/; it != end; ++it ) @@ -303,21 +303,21 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X const char *type = pItem->Value(); if( type == NULL ) { - LOG_DEBUG( "��������Ϊ��" ); + LOG_DEBUG( "参数名字为空" ); continue; } tinyxml2::XMLNode *pValue = pItem->FirstChild(); if( pValue == NULL ) { - LOG_DEBUG( "����ֵû������" ); + LOG_DEBUG( "参数值没有设置" ); continue; } const char *value = pValue->Value(); if( value == NULL ) { - LOG_DEBUG( "����ֵΪ��" ); + LOG_DEBUG( "参数值为空" ); continue; } @@ -357,7 +357,7 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X } else { - LOG_ERROR( "Event����ֵ\'{}\'��Ч", value ); + LOG_ERROR( "Event参数值\'{}\'无效", value ); return cat_list; } } @@ -488,21 +488,21 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X pValue = pInfo->FirstChild(); if( pValue == NULL ) { - LOG_DEBUG( "����ֵû������" ); + LOG_DEBUG( "参数值没有设置" ); continue; } const char *type = pInfo->Value(); if( type == NULL ) { - LOG_DEBUG( "��������Ϊ��" ); + LOG_DEBUG( "参数名字为空" ); continue; } const char *value = pValue->Value(); if( value == NULL ) { - LOG_DEBUG( "����ֵΪ��" ); + LOG_DEBUG( "参数值为空" ); continue; } @@ -540,13 +540,13 @@ std::vector< DeviceInfo > CCatalogParser::Decode( const std::vector< tinyxml2::X } else { - LOG_DEBUG( "����δ����IJ���:{}" , type ); + LOG_DEBUG( "国标未定义的参数:{}" , type ); } } } else { - LOG_DEBUG( "����δ����IJ���:{}" , type ); + LOG_DEBUG( "国标未定义的参数:{}" , type ); } } @@ -622,10 +622,9 @@ std::vector< DeviceInfo > CCatalogParser::Decode_Catlog(const char* body) cat_list = Decode(nodes); if (cat_list.empty()) { - LOG_ERROR("��Ϣ���������!"); + LOG_ERROR("消息体解析错误!"); } } - return cat_list; } \ No newline at end of file