LCOV - code coverage report
Current view: top level - app/MessageDef - MessageParser.cpp (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 12 14 85.7 %
Date: 2024-02-15 08:20:41 Functions: 3 4 75.0 %

          Line data    Source code
       1             : /**
       2             :  *
       3             :  *    Copyright (c) 2021 Project CHIP Authors
       4             :  *    Licensed under the Apache License, Version 2.0 (the "License");
       5             :  *    you may not use this file except in compliance with the License.
       6             :  *    You may obtain a copy of the License at
       7             :  *
       8             :  *        http://www.apache.org/licenses/LICENSE-2.0
       9             :  *
      10             :  *    Unless required by applicable law or agreed to in writing, software
      11             :  *    distributed under the License is distributed on an "AS IS" BASIS,
      12             :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13             :  *    See the License for the specific language governing permissions and
      14             :  *    limitations under the License.
      15             :  */
      16             : 
      17             : #include "MessageParser.h"
      18             : #include "MessageDefHelper.h"
      19             : #include <app/InteractionModelRevision.h>
      20             : 
      21             : namespace chip {
      22             : namespace app {
      23        8775 : CHIP_ERROR MessageParser::Init(TLV::TLVReader & aReader)
      24             : {
      25        8775 :     ReturnErrorOnFailure(aReader.Next(TLV::kTLVType_Structure, TLV::AnonymousTag()));
      26        8774 :     return StructParser::Init(aReader);
      27             : }
      28             : 
      29        7800 : CHIP_ERROR MessageParser::ExitContainer()
      30             : {
      31             :     // Ignore any other tags that might be here.
      32        7800 :     ReturnErrorOnFailure(mReader.ExitContainer(mOuterContainerType));
      33             : 
      34             :     // There should be nothing outside the toplevel struct.
      35        7799 :     VerifyOrReturnError(mReader.Next() == CHIP_END_OF_TLV, CHIP_ERROR_INVALID_TLV_TAG);
      36        7799 :     return CHIP_NO_ERROR;
      37             : }
      38             : 
      39             : #if CHIP_CONFIG_IM_PRETTY_PRINT
      40        7724 : CHIP_ERROR MessageParser::CheckInteractionModelRevision(TLV::TLVReader & aReader) const
      41             : {
      42             : #if CHIP_DETAIL_LOGGING
      43             :     {
      44        7724 :         uint8_t interactionModelRevision = 0;
      45        7724 :         ReturnErrorOnFailure(aReader.Get(interactionModelRevision));
      46        7724 :         PRETTY_PRINT("\tInteractionModelRevision = %u", interactionModelRevision);
      47             :     }
      48             : #endif // CHIP_DETAIL_LOGGING
      49        7724 :     return CHIP_NO_ERROR;
      50             : }
      51             : #endif // CHIP_CONFIG_IM_PRETTY_PRINT
      52             : 
      53           0 : CHIP_ERROR MessageParser::GetInteractionModelRevision(InteractionModelRevision * const apInteractionModelRevision) const
      54             : {
      55           0 :     return GetUnsignedInteger(kInteractionModelRevisionTag, apInteractionModelRevision);
      56             : }
      57             : 
      58             : } // namespace app
      59             : } // namespace chip

Generated by: LCOV version 1.14