Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/wifi_RS9116_fixes_for_hardfault_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bhmanda-silabs authored Feb 23, 2024
2 parents bb0c44b + a6fd6ce commit eeecacc
Show file tree
Hide file tree
Showing 42 changed files with 277 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ constexpr uint8_t kMaxFileDesignatorLen = 32;
constexpr uint16_t kMaxFilePathLen = kMaxFileDesignatorLen + sizeof(kTmpDir) + 1;

// For testing a few file names trigger an error depending on the current 'phase'.
constexpr char kErrorOnTransferBegin[] = "Error:OnTransferBegin";
constexpr char kErrorOnTransferData[] = "Error:OnTransferData";
constexpr char kErrorOnTransferEnd[] = "Error:OnTransferEnd";
constexpr char kErrorOnTransferBegin[] = "Error:OnTransferBegin";
constexpr char kErrorOnTransferData[] = "Error:OnTransferData";
constexpr char kErrorOnTransferEnd[] = "Error:OnTransferEnd";
constexpr char kErrorTransferMethodNotSupported[] = "TransferMethodNotSupported.txt";

BDXDiagnosticLogsServerDelegate BDXDiagnosticLogsServerDelegate::sInstance;

Expand Down Expand Up @@ -136,8 +137,14 @@ CHIP_ERROR BDXDiagnosticLogsServerDelegate::OnTransferBegin(chip::bdx::BDXTransf
auto fileDesignator = transfer->GetFileDesignator();
LogFileDesignator("OnTransferBegin", fileDesignator);

VerifyOrReturnError(fileDesignator.size() != 0, CHIP_ERROR_UNKNOWN_RESOURCE_ID);

chip::CharSpan phaseErrorTarget(kErrorOnTransferBegin, sizeof(kErrorOnTransferBegin) - 1);
ReturnErrorOnFailure(CheckForErrorRequested(phaseErrorTarget, fileDesignator));

chip::CharSpan transferErrorTarget(kErrorTransferMethodNotSupported, sizeof(kErrorTransferMethodNotSupported) - 1);
VerifyOrReturnError(!transferErrorTarget.data_equal(fileDesignator), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE);

ReturnErrorOnFailure(CheckFileDesignatorAllowed(mFileDesignators, fileDesignator));

char outputFilePath[kMaxFilePathLen] = { 0 };
Expand Down
23 changes: 13 additions & 10 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ source_set("app_config") {
deps = [ ":app_buildconfig" ]
}

source_set("revision_info") {
sources = [
"DataModelRevision.h",
"InteractionModelRevision.h",
"SpecificationVersion.h",
]
}

source_set("paths") {
sources = [
"AttributePathParams.h",
Expand Down Expand Up @@ -130,6 +122,17 @@ config("config-controller-dynamic-server") {
]
}

source_set("constants") {
sources = [
"InteractionModelTimeout.h",
"SpecificationDefinedRevisions.h",
]
public_deps = [
"${chip_root}/src/lib/core",
"${chip_root}/src/system",
]
}

# interaction-model is a static-library because it currently requires global functions (app/util/...) that are stubbed in different test files that depend on the app static_library
# which in tern depens on the interaction-model.
# Using source_set prevents the unit test to build correctly.
Expand All @@ -149,7 +152,6 @@ static_library("interaction-model") {
"InteractionModelEngine.cpp",
"InteractionModelEngine.h",
"InteractionModelHelper.h",
"InteractionModelTimeout.h",
"OperationalSessionSetup.cpp",
"OperationalSessionSetup.h",
"OperationalSessionSetupPool.h",
Expand Down Expand Up @@ -181,6 +183,7 @@ static_library("interaction-model") {

public_deps = [
":app_config",
":constants",
":paths",
":subscription-manager",
"${chip_root}/src/app/MessageDef",
Expand Down Expand Up @@ -276,9 +279,9 @@ static_library("app") {

public_deps = [
":app_config",
":constants",
":global-attributes",
":interaction-model",
":revision_info",
"${chip_root}/src/app/data-model",
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/lib/address_resolve",
Expand Down
31 changes: 0 additions & 31 deletions src/app/DataModelRevision.h

This file was deleted.

1 change: 0 additions & 1 deletion src/app/InteractionModelTimeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#pragma once

#include <system/SystemClock.h>
#include <transport/Session.h>

namespace chip {
namespace app {
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ source_set("MessageDef") {

deps = [
"${chip_root}/src/app:app_config",
"${chip_root}/src/app:constants",
"${chip_root}/src/app:paths",
"${chip_root}/src/app:revision_info",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/protocols/interaction_model",
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CHIP_ERROR InvokeRequestMessage::Parser::PrettyPrint() const
PRETTY_PRINT_DECDEPTH();
}
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/InvokeResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CHIP_ERROR InvokeResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
3 changes: 1 addition & 2 deletions src/app/MessageDef/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ namespace chip {
namespace app {
CHIP_ERROR MessageBuilder::EncodeInteractionModelRevision()
{
return mpWriter->Put(TLV::ContextTag(kInteractionModelRevisionTag),
static_cast<InteractionModelRevision>(CHIP_DEVICE_INTERACTION_MODEL_REVISION));
return mpWriter->Put(TLV::ContextTag(Revision::kInteractionModelRevisionTag), Revision::kInteractionModelRevision);
}
} // namespace app
} // namespace chip
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#pragma once

#include "StructBuilder.h"
#include <app/InteractionModelRevision.h>
#include <app/SpecificationDefinedRevisions.h>
#include <app/util/basic-types.h>

namespace chip {
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageDefHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "MessageDefHelper.h"
#include <algorithm>
#include <app/AppConfig.h>
#include <app/InteractionModelRevision.h>
#include <app/SpecificationDefinedRevisions.h>
#include <app/util/basic-types.h>
#include <inttypes.h>
#include <lib/support/logging/CHIPLogging.h>
Expand Down
4 changes: 2 additions & 2 deletions src/app/MessageDef/MessageParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "MessageParser.h"
#include "MessageDefHelper.h"
#include <app/InteractionModelRevision.h>
#include <app/SpecificationDefinedRevisions.h>

namespace chip {
namespace app {
Expand Down Expand Up @@ -52,7 +52,7 @@ CHIP_ERROR MessageParser::CheckInteractionModelRevision(TLV::TLVReader & aReader

CHIP_ERROR MessageParser::GetInteractionModelRevision(InteractionModelRevision * const apInteractionModelRevision) const
{
return GetUnsignedInteger(kInteractionModelRevisionTag, apInteractionModelRevision);
return GetUnsignedInteger(Revision::kInteractionModelRevisionTag, apInteractionModelRevision);
}

} // namespace app
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/MessageParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "StructParser.h"
#include <app/AppConfig.h>
#include <app/InteractionModelRevision.h>
#include <app/SpecificationDefinedRevisions.h>
#include <app/util/basic-types.h>

namespace chip {
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ReadRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CHIP_ERROR ReadRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/ReportDataMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CHIP_ERROR ReportDataMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/StatusResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CHIP_ERROR StatusResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/SubscribeRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ CHIP_ERROR SubscribeRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/SubscribeResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CHIP_ERROR SubscribeResponseMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/TimedRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CHIP_ERROR TimedRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/WriteRequestMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CHIP_ERROR WriteRequestMessage::Parser::PrettyPrint() const
}
#endif // CHIP_DETAIL_LOGGING
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/app/MessageDef/WriteResponseMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CHIP_ERROR WriteResponseMessage::Parser::PrettyPrint() const
ReturnErrorOnFailure(writeResponses.PrettyPrint());
PRETTY_PRINT_DECDEPTH();
break;
case kInteractionModelRevisionTag:
case Revision::kInteractionModelRevisionTag:
ReturnErrorOnFailure(MessageParser::CheckInteractionModelRevision(reader));
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,37 @@
#include <inttypes.h>
#include <stddef.h>

#include <lib/core/DataModelTypes.h>

namespace chip {
namespace Revision {

/**
* CHIP_DEVICE_INTERACTION_MODEL_REVISION
*
* A monothonic number identifying the interaction model revision.
*
* See section 8.1.1. "Revision History" in the "Interaction Model
* Specification" chapter of the core Matter specification.
*/
#ifndef CHIP_DEVICE_INTERACTION_MODEL_REVISION
#define CHIP_DEVICE_INTERACTION_MODEL_REVISION 11
#endif
inline constexpr InteractionModelRevision kInteractionModelRevision = 11;
inline constexpr uint8_t kInteractionModelRevisionTag = 0xFF;

/**
* A monotonic number identifying the revision number of the Data Model against
* which the Node is certified.
*
* See section 7.1.1. "Revision History" in the "Data Model Specification"
* chapter of the core Matter specification.
*/
inline constexpr uint16_t kDataModelRevision = 17;

/*
* A number identifying the specification version against which the
* Node is certified.
*
* See section 11.1.5.22. "SpecificationVersion Attribute" in "Service and
* Device Management" chapter of the core Matter specification.
*/
inline constexpr uint32_t kSpecificationVersion = 0x01030000;

inline constexpr uint8_t kInteractionModelRevisionTag = 0xFF;
} // namespace Revision
} // namespace chip
31 changes: 0 additions & 31 deletions src/app/SpecificationVersion.h

This file was deleted.

7 changes: 3 additions & 4 deletions src/app/clusters/basic-information/basic-information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app/DataModelRevision.h>
#include <app/EventLogging.h>
#include <app/InteractionModelEngine.h>
#include <app/SpecificationVersion.h>
#include <app/SpecificationDefinedRevisions.h>
#include <app/util/attribute-storage.h>
#include <lib/core/CHIPConfig.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down Expand Up @@ -314,7 +313,7 @@ CHIP_ERROR BasicAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attrib

CHIP_ERROR BasicAttrAccess::ReadDataModelRevision(AttributeValueEncoder & aEncoder)
{
uint16_t revision = CHIP_DEVICE_DATA_MODEL_REVISION;
uint16_t revision = Revision::kDataModelRevision;
return aEncoder.Encode(revision);
}

Expand Down Expand Up @@ -399,7 +398,7 @@ CHIP_ERROR BasicAttrAccess::ReadProductAppearance(AttributeValueEncoder & aEncod

CHIP_ERROR BasicAttrAccess::ReadSpecificationVersion(AttributeValueEncoder & aEncoder)
{
uint32_t specification_version = CHIP_DEVICE_SPECIFICATION_VERSION;
uint32_t specification_version = Revision::kSpecificationVersion;
return aEncoder.Encode(specification_version);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ void DiagnosticLogsServer::HandleLogRequestForBdx(CommandHandler * commandObj, c
// INVALID_COMMAND.
VerifyOrReturn(transferFileDesignator.HasValue(), commandObj->AddStatus(path, Status::InvalidCommand));

VerifyOrReturn(transferFileDesignator.Value().size() > 0, commandObj->AddStatus(path, Status::ConstraintError));

VerifyOrReturn(transferFileDesignator.Value().size() <= kMaxFileDesignatorLen,
commandObj->AddStatus(path, Status::ConstraintError));

Expand Down
Loading

0 comments on commit eeecacc

Please sign in to comment.