Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICD] Add units to configs and variables #29417

Merged
merged 6 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 * 0.75)
#define ICD_SLEEP_TIME_JITTER_MS (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 0.75)
#endif

#ifndef ICD_ACTIVE_TIME_JITTER_MS
Expand Down
33 changes: 12 additions & 21 deletions src/app/icd/IcdManagementServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,11 @@ using chip::Protocols::InteractionModel::Status;
class IcdManagementServer
{
public:
void Init(uint32_t idle_interval, uint32_t active_interval, uint16_t active_threshold, uint32_t count,
uint16_t fabric_clients_supported)
{
mIdleInterval = idle_interval;
mActiveInterval = active_interval;
mActiveThreshold = active_threshold;
mIcdCounter = count;
mFabricClientsSupported = fabric_clients_supported;
}
uint32_t GetIdleModeInterval() { return mIdleInterval_s; }

uint32_t GetIdleModeInterval() { return mIdleInterval; }
uint32_t GetActiveModeInterval() { return mActiveInterval_ms; }
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved

uint32_t GetActiveModeInterval() { return mActiveInterval; }

uint16_t GetActiveModeThreshold() { return mActiveThreshold; }
uint16_t GetActiveModeThreshold() { return mActiveThreshold_ms; }

uint32_t GetICDCounter() { return mIcdCounter; }

Expand All @@ -67,20 +57,21 @@ class IcdManagementServer

static IcdManagementServer mInstance;

static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL) <= 64800,
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) >= 1, "Spec requires the IdleModeInterval to be equal or greater to 1s.");
uint32_t mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; // in seconds.
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; // in seconds.

static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL * 1000),
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC * 1000),
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
"Spec requires the IdleModeInterval be equal or greater to the ActiveModeInterval.");
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) >= 300,
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS) >= 300,
"Spec requires the ActiveModeThreshold to be equal or greater to 300ms");
uint32_t mActiveInterval = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL; // in milliseconds
uint32_t mActiveInterval_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS; // in milliseconds
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved

static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD) >= 300,
static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS) >= 300,
"Spec requires the ActiveModeThreshold to be equal or greater to 300ms.");
uint16_t mActiveThreshold = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD; // in milliseconds
uint16_t mActiveThreshold_ms = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS; // in milliseconds

uint32_t mIcdCounter = 0;

Expand Down
18 changes: 9 additions & 9 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1498,30 +1498,30 @@ extern const char CHIP_NON_PRODUCTION_MARKER[];
#endif

/**
* @def CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
* @def CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
*
* @brief Default value for the ICD Management cluster IdleModeInterval attribute, in seconds
*/
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL 2
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC 2
#endif

/**
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
*
* @brief Default value for the ICD Management cluster ActiveModeInterval attribute, in milliseconds
*/
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL 300
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS 300
#endif

/**
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
* @def CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
*
* @brief Default value for the ICD Management cluster ActiveModeThreshold attribute, in milliseconds
*/
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD 300
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 300
#endif

/**
Expand Down
18 changes: 9 additions & 9 deletions src/platform/nrfconnect/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@
#endif // CHIP_ENABLE_OPENTHREAD
#endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL

#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS

#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC
#ifdef CONFIG_CHIP_ICD_CLIENTS_PER_FABRIC
Expand Down
18 changes: 9 additions & 9 deletions src/platform/silabs/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@

#ifdef SL_ICD_ENABLED

#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL SL_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC
#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC SL_IDLE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL_SEC

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL SL_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS SL_ACTIVE_MODE_INTERVAL
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS

#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD SL_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD
#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS SL_ACTIVE_MODE_THRESHOLD
#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS

#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC
#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC
Expand Down