Skip to content

Commit

Permalink
[ICD] Rename attributes to match specification (#29965)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs authored Oct 24, 2023
1 parent 7a952fc commit 3aac08f
Show file tree
Hide file tree
Showing 50 changed files with 305 additions and 305 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2465,8 +2465,8 @@ server cluster IcdManagement = 70 {
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeInterval = 0;
readonly attribute int32u activeModeInterval = 1;
readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute access(read: administer) MonitoringRegistrationStruct registeredClients[] = 3;
readonly attribute access(read: administer) int32u ICDCounter = 4;
Expand Down Expand Up @@ -5612,8 +5612,8 @@ endpoint 0 {
}

server cluster IcdManagement {
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute idleModeDuration default = 500;
callback attribute activeModeDuration default = 300;
callback attribute activeModeThreshold default = 300;
callback attribute registeredClients;
callback attribute ICDCounter default = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5862,7 +5862,7 @@
],
"attributes": [
{
"name": "IdleModeInterval",
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -5878,7 +5878,7 @@
"reportableChange": 0
},
{
"name": "ActiveModeInterval",
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1958,8 +1958,8 @@ server cluster IcdManagement = 70 {
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeInterval = 0;
readonly attribute int32u activeModeInterval = 1;
readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand Down Expand Up @@ -2657,8 +2657,8 @@ endpoint 0 {
}

server cluster IcdManagement {
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute idleModeDuration default = 500;
callback attribute activeModeDuration default = 300;
callback attribute activeModeThreshold default = 300;
ram attribute featureMap default = 0x0000;
ram attribute clusterRevision default = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4448,7 +4448,7 @@
"enabled": 1,
"attributes": [
{
"name": "IdleModeInterval",
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -4464,7 +4464,7 @@
"reportableChange": 0
},
{
"name": "ActiveModeInterval",
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/lock-common/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1689,8 +1689,8 @@ server cluster IcdManagement = 70 {
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeInterval = 0;
readonly attribute int32u activeModeInterval = 1;
readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand Down Expand Up @@ -2694,8 +2694,8 @@ endpoint 0 {
}

server cluster IcdManagement {
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute idleModeDuration default = 500;
callback attribute activeModeDuration default = 300;
callback attribute activeModeThreshold default = 300;
ram attribute featureMap default = 0x0000;
ram attribute clusterRevision default = 1;
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/lock-common/lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -5039,7 +5039,7 @@
"enabled": 1,
"attributes": [
{
"name": "IdleModeInterval",
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -5055,7 +5055,7 @@
"reportableChange": 0
},
{
"name": "ActiveModeInterval",
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1571,8 +1571,8 @@ server cluster IcdManagement = 70 {
fabric_idx fabricIndex = 254;
}

readonly attribute int32u idleModeInterval = 0;
readonly attribute int32u activeModeInterval = 1;
readonly attribute int32u idleModeDuration = 0;
readonly attribute int32u activeModeDuration = 1;
readonly attribute int16u activeModeThreshold = 2;
readonly attribute access(read: administer) MonitoringRegistrationStruct registeredClients[] = 3;
readonly attribute access(read: administer) int32u ICDCounter = 4;
Expand Down Expand Up @@ -1998,8 +1998,8 @@ endpoint 0 {
}

server cluster IcdManagement {
callback attribute idleModeInterval default = 500;
callback attribute activeModeInterval default = 300;
callback attribute idleModeDuration default = 500;
callback attribute activeModeDuration default = 300;
callback attribute activeModeThreshold default = 300;
callback attribute registeredClients;
callback attribute ICDCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3505,7 +3505,7 @@
],
"attributes": [
{
"name": "IdleModeInterval",
"name": "IdleModeDuration",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -3521,7 +3521,7 @@
"reportableChange": 0
},
{
"name": "ActiveModeInterval",
"name": "ActiveModeDuration",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
10 changes: 5 additions & 5 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ using Status = Protocols::InteractionModel::Status;
uint16_t ReadHandler::GetPublisherSelectedIntervalLimit()
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER
return static_cast<uint16_t>(ICDManagementServer::GetInstance().GetIdleModeIntervalSec());
return static_cast<uint16_t>(ICDManagementServer::GetInstance().GetIdleModeDurationSec());
#else
return kSubscriptionMaxIntervalPublisherLimit;
#endif
Expand Down Expand Up @@ -719,17 +719,17 @@ CHIP_ERROR ReadHandler::ProcessSubscribeRequest(System::PacketBufferHandle && aP

#if CHIP_CONFIG_ENABLE_ICD_SERVER

// Default behavior for ICDs where the wanted MaxInterval for a subscription is the IdleModeInterval
// Default behavior for ICDs where the wanted MaxInterval for a subscription is the IdleModeDuration
// defined in the ICD Management Cluster.
// Behavior can be changed with the OnSubscriptionRequested function defined in the application callbacks

// Default Behavior Steps :
// If MinInterval > IdleModeInterval, try to set the MaxInterval to the first interval of IdleModeIntervals above the
// If MinInterval > IdleModeDuration, try to set the MaxInterval to the first interval of IdleModeDurations above the
// MinInterval.
// If the next interval is greater than the MaxIntervalCeiling, use the MaxIntervalCeiling.
// Otherwise, use IdleModeInterval as MaxInterval
// Otherwise, use IdleModeDuration as MaxInterval

// GetPublisherSelectedIntervalLimit() returns the IdleModeInterval if the device is an ICD
// GetPublisherSelectedIntervalLimit() returns the IdleModeDuration if the device is an ICD
uint32_t decidedMaxInterval = GetPublisherSelectedIntervalLimit();

// Check if the PublisherSelectedIntervalLimit is 0. If so, set decidedMaxInterval to MaxIntervalCeiling
Expand Down
20 changes: 10 additions & 10 deletions src/app/clusters/icd-management-server/icd-management-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class IcdManagementAttributeAccess : public app::AttributeAccessInterface
CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;

private:
CHIP_ERROR ReadIdleModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadActiveModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadIdleModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadActiveModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadActiveModeThreshold(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder);
CHIP_ERROR ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder);
Expand All @@ -65,11 +65,11 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath &

switch (aPath.mAttributeId)
{
case IcdManagement::Attributes::IdleModeInterval::Id:
return ReadIdleModeInterval(aPath.mEndpointId, aEncoder);
case IcdManagement::Attributes::IdleModeDuration::Id:
return ReadIdleModeDuration(aPath.mEndpointId, aEncoder);

case IcdManagement::Attributes::ActiveModeInterval::Id:
return ReadActiveModeInterval(aPath.mEndpointId, aEncoder);
case IcdManagement::Attributes::ActiveModeDuration::Id:
return ReadActiveModeDuration(aPath.mEndpointId, aEncoder);

case IcdManagement::Attributes::ActiveModeThreshold::Id:
return ReadActiveModeThreshold(aPath.mEndpointId, aEncoder);
Expand All @@ -87,14 +87,14 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath &
return CHIP_NO_ERROR;
}

CHIP_ERROR IcdManagementAttributeAccess::ReadIdleModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder)
CHIP_ERROR IcdManagementAttributeAccess::ReadIdleModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(ICDManagementServer::GetInstance().GetIdleModeIntervalSec());
return encoder.Encode(ICDManagementServer::GetInstance().GetIdleModeDurationSec());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder)
CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(ICDManagementServer::GetInstance().GetActiveModeIntervalMs());
return encoder.Encode(ICDManagementServer::GetInstance().GetActiveModeDurationMs());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeThreshold(EndpointId endpoint, AttributeValueEncoder & encoder)
Expand Down
20 changes: 10 additions & 10 deletions src/app/icd/ICDManagementServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ using chip::Protocols::InteractionModel::Status;
class ICDManagementServer
{
public:
uint32_t GetIdleModeIntervalSec() { return mIdleInterval_s; }
uint32_t GetIdleModeDurationSec() { return mIdleInterval_s; }

uint32_t GetActiveModeIntervalMs() { return mActiveInterval_ms; }
uint32_t GetActiveModeDurationMs() { return mActiveInterval_ms; }

void SetSymmetricKeystore(Crypto::SymmetricKeystore * keyStore) { mSymmetricKeystore = keyStore; }

Expand Down Expand Up @@ -63,15 +63,15 @@ class ICDManagementServer
static ICDManagementServer mInstance;
Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr;

static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC) <= 64800,
"Spec requires the IdleModeInterval to be equal or inferior to 64800s.");
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC) >= 1,
"Spec requires the IdleModeInterval to be equal or greater to 1s.");
uint32_t mIdleInterval_s = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC;
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) <= 64800,
"Spec requires the IdleModeDuration to be equal or inferior to 64800s.");
static_assert((CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC) >= 1,
"Spec requires the IdleModeDuration to be equal or greater to 1s.");
uint32_t mIdleInterval_s = CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC;

static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * kMillisecondsPerSecond),
"Spec requires the IdleModeInterval be equal or greater to the ActiveModeInterval.");
uint32_t mActiveInterval_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS;
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC * kMillisecondsPerSecond),
"Spec requires the IdleModeDuration be equal or greater to the ActiveModeDuration.");
uint32_t mActiveInterval_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS;

uint16_t mActiveThreshold_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS;

Expand Down
24 changes: 12 additions & 12 deletions src/app/icd/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT
ICDManagementServer::GetInstance().SetSymmetricKeystore(mSymmetricKeystore);

// Removing the check for now since it is possible for the Fast polling
// to be larger than the ActiveModeInterval for now
// uint32_t activeModeInterval = ICDManagementServer::GetInstance().GetActiveModeIntervalMs();
// VerifyOrDie(kFastPollingInterval.count() < activeModeInterval);
// to be larger than the ActiveModeDuration for now
// uint32_t activeModeDuration = ICDManagementServer::GetInstance().GetActiveModeDurationMs();
// VerifyOrDie(kFastPollingInterval.count() < activeModeDuration);

UpdateICDMode();
UpdateOperationState(OperationalState::ActiveMode);
Expand Down Expand Up @@ -138,10 +138,10 @@ void ICDManager::UpdateOperationState(OperationalState state)
mOperationalState = OperationalState::IdleMode;

// When the active mode interval is 0, we stay in idleMode until a notification brings the icd into active mode
if (ICDManagementServer::GetInstance().GetActiveModeIntervalMs() > 0)
if (ICDManagementServer::GetInstance().GetActiveModeDurationMs() > 0)
{
uint32_t idleModeInterval = ICDManagementServer::GetInstance().GetIdleModeIntervalSec();
DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(idleModeInterval), OnIdleModeDone, this);
uint32_t idleModeDuration = ICDManagementServer::GetInstance().GetIdleModeDurationSec();
DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(idleModeDuration), OnIdleModeDone, this);
}

System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval();
Expand Down Expand Up @@ -169,19 +169,19 @@ void ICDManager::UpdateOperationState(OperationalState state)
DeviceLayer::SystemLayer().CancelTimer(OnIdleModeDone, this);

mOperationalState = OperationalState::ActiveMode;
uint32_t activeModeInterval = ICDManagementServer::GetInstance().GetActiveModeIntervalMs();
uint32_t activeModeDuration = ICDManagementServer::GetInstance().GetActiveModeDurationMs();

if (activeModeInterval == 0 && !mKeepActiveFlags.HasAny())
if (activeModeDuration == 0 && !mKeepActiveFlags.HasAny())
{
// A Network Activity triggered the active mode and activeModeInterval is 0.
// A Network Activity triggered the active mode and activeModeDuration is 0.
// Stay active for at least Active Mode Threshold.
activeModeInterval = ICDManagementServer::GetInstance().GetActiveModeThresholdMs();
activeModeDuration = ICDManagementServer::GetInstance().GetActiveModeThresholdMs();
}

DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(activeModeInterval), OnActiveModeDone, this);
DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(activeModeDuration), OnActiveModeDone, this);

uint32_t activeModeJitterInterval =
(activeModeInterval >= ICD_ACTIVE_TIME_JITTER_MS) ? activeModeInterval - ICD_ACTIVE_TIME_JITTER_MS : 0;
(activeModeDuration >= ICD_ACTIVE_TIME_JITTER_MS) ? activeModeDuration - ICD_ACTIVE_TIME_JITTER_MS : 0;
DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(activeModeJitterInterval), OnTransitionToIdle, this);

CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(GetFastPollingInterval());
Expand Down
4 changes: 2 additions & 2 deletions src/app/icd/ICDManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class ICDManager : public ICDListener
static constexpr System::Clock::Milliseconds32 kFastPollingInterval = CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL;

// Minimal constraint value of the the ICD attributes.
static constexpr uint32_t kMinIdleModeInterval = 500;
static constexpr uint32_t kMinActiveModeInterval = 300;
static constexpr uint32_t kMinIdleModeDuration = 500;
static constexpr uint32_t kMinActiveModeDuration = 300;
static constexpr uint16_t kMinActiveModeThreshold = 300;

bool SupportsCheckInProtocol();
Expand Down
2 changes: 1 addition & 1 deletion src/app/icd/ICDNotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace app {
/**
* The ICDManager implements the ICDListener functions and is always subscribed to the ICDNotifier
* This allows other Matter modules to inform the ICDManager that it needs to go and may have to stay in Active Mode,
* outside of its standard ActiveModeInterval and IdleModeInterval, without being tightly coupled the application data model
* outside of its standard ActiveModeDuration and IdleModeDuration, without being tightly coupled the application data model
*
* This implementation also allows other modules to implement an ICDListener and subscribe to ICDNotifier
* to couple behaviours with the ICD cycles. In such cases, ICD_MAX_NOTIFICATION_SUBSCRIBERS need to be adjusted
Expand Down
2 changes: 1 addition & 1 deletion src/app/icd/ICDStateObserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#pragma once

#ifndef ICD_SLEEP_TIME_JITTER_MS
#define ICD_SLEEP_TIME_JITTER_MS (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 0.75)
#define ICD_SLEEP_TIME_JITTER_MS (CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC * 0.75)
#endif

#ifndef ICD_ACTIVE_TIME_JITTER_MS
Expand Down
Loading

0 comments on commit 3aac08f

Please sign in to comment.