Skip to content

Commit

Permalink
ICD: Publisher-selected maximum subscription interval. (#27272)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs authored and pull[bot] committed Feb 26, 2024
1 parent 06f23d3 commit 5557926
Show file tree
Hide file tree
Showing 22 changed files with 389 additions and 363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6489,12 +6489,12 @@ endpoint 0 {
}

server cluster IcdManagement {
ram attribute idleModeInterval default = 500;
ram attribute activeModeInterval default = 300;
ram attribute activeModeThreshold default = 300;
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute activeModeThreshold default = 300;
callback attribute registeredClients;
ram attribute ICDCounter default = 0;
ram attribute clientsSupportedPerFabric default = 2;
callback attribute ICDCounter default = 0;
callback attribute clientsSupportedPerFabric default = 2;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2474,12 +2474,12 @@ endpoint 0 {
}

server cluster IcdManagement {
ram attribute idleModeInterval default = 500;
ram attribute activeModeInterval default = 300;
ram attribute activeModeThreshold default = 300;
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute activeModeThreshold default = 300;
callback attribute registeredClients;
ram attribute ICDCounter;
ram attribute clientsSupportedPerFabric default = 1;
callback attribute ICDCounter;
callback attribute clientsSupportedPerFabric default = 1;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2166,12 +2166,12 @@ endpoint 0 {
}

server cluster IcdManagement {
ram attribute idleModeInterval default = 500;
ram attribute activeModeInterval default = 300;
ram attribute activeModeThreshold default = 300;
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute activeModeThreshold default = 300;
callback attribute registeredClients;
ram attribute ICDCounter;
ram attribute clientsSupportedPerFabric default = 1;
callback attribute ICDCounter;
callback attribute clientsSupportedPerFabric default = 1;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down
1 change: 1 addition & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ static_library("app") {
public_deps = [
":app_config",
"${chip_root}/src/access",
"${chip_root}/src/app/icd:cluster-srcs",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
Expand Down
13 changes: 13 additions & 0 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,23 @@
#include <app/ReadHandler.h>
#include <app/reporting/Engine.h>

#if CHIP_CONFIG_ENABLE_ICD_SERVER
#include <app/icd/IcdManagementServer.h> // nogncheck
#endif

namespace chip {
namespace app {
using Status = Protocols::InteractionModel::Status;

uint16_t ReadHandler::GetPublisherSelectedIntervalLimit()
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER
return static_cast<uint16_t>(IcdManagementServer::GetInstance().GetIdleModeInterval() / 1000);
#else
return kSubscriptionMaxIntervalPublisherLimit;
#endif
}

ReadHandler::ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeContext * apExchangeContext,
InteractionType aInteractionType, Observer * observer) :
mExchangeCtx(*this),
Expand Down
11 changes: 9 additions & 2 deletions src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <system/SystemPacketBuffer.h>

// https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/61a9d19e6af12fdfb0872bcff26d19de6c680a1a/src/Ch02_Architecture.adoc#1122-subscribe-interaction-limits
constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // 3600 seconds
constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // seconds (60 minutes)

namespace chip {
namespace app {
Expand Down Expand Up @@ -244,7 +244,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
{
VerifyOrReturnError(IsIdle(), CHIP_ERROR_INCORRECT_STATE);
VerifyOrReturnError(mMinIntervalFloorSeconds <= aMaxInterval, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(aMaxInterval <= std::max(kSubscriptionMaxIntervalPublisherLimit, mMaxInterval),
VerifyOrReturnError(aMaxInterval <= std::max(GetPublisherSelectedIntervalLimit(), mMaxInterval),
CHIP_ERROR_INVALID_ARGUMENT);
mMaxInterval = aMaxInterval;
return CHIP_NO_ERROR;
Expand All @@ -266,6 +266,13 @@ class ReadHandler : public Messaging::ExchangeDelegate
PriorityLevel GetCurrentPriority() const { return mCurrentPriority; }
EventNumber & GetEventMin() { return mEventMin; }

/**
* Returns SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT
* For an ICD publisher, this SHALL be set to the idle mode interval.
* Otherwise, this SHALL be set to 60 minutes.
*/
uint16_t GetPublisherSelectedIntervalLimit();

enum class ReadHandlerFlags : uint8_t
{
// WaitingUntilMinInterval is used to prevent subscription data delivery while we are
Expand Down
1 change: 1 addition & 0 deletions src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function(chip_configure_data_model APP_TARGET)
${CHIP_APP_BASE_DIR}/util/attribute-table.cpp
${CHIP_APP_BASE_DIR}/util/binding-table.cpp
${CHIP_APP_BASE_DIR}/icd/IcdMonitoringTable.cpp
${CHIP_APP_BASE_DIR}/icd/IcdManagementServer.cpp
${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp
${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp
${CHIP_APP_BASE_DIR}/util/error-mapping.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ template("chip_data_model") {
} else if (cluster == "icd-management-server") {
sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ]

deps += [ "${chip_root}/src/app/icd:monitoring-table" ]
deps += [ "${chip_root}/src/app/icd:cluster-srcs" ]
} else {
sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ]
}
Expand Down
Loading

0 comments on commit 5557926

Please sign in to comment.