Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kkasperczyk-no committed Sep 8, 2023
1 parent ce417ba commit b1a3ada
Show file tree
Hide file tree
Showing 42 changed files with 122 additions and 232 deletions.
1 change: 1 addition & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ matter_add_gn_arg_bool ("chip_automation_logging" FALSE)
matter_add_gn_arg_bool ("chip_malloc_sys_heap" CONFIG_CHIP_MALLOC_SYS_HEAP)
matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_WIFI_NRF700X)
matter_add_gn_arg_bool ("chip_system_config_provide_statistics" CONFIG_CHIP_STATISTICS)
matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT)

if (CONFIG_CHIP_FACTORY_DATA)
matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE)
Expand Down
23 changes: 0 additions & 23 deletions config/nrfconnect/chip-module/Kconfig.features
Original file line number Diff line number Diff line change
Expand Up @@ -230,27 +230,4 @@ config CHIP_WIFI_CONNECTION_RECOVERY_JITTER
a random jitter interval is added to it to avoid periodicity. The random jitter is selected
within range [-JITTER; +JITTER].

config CHIP_ICD_SUBSCRIPTION_HANDLING
bool "Enables platform specific handling of ICD subscriptions"
help
Enables platform specific implementation that handles ICD subscription requests
and selects subscription report interval value considering maximum interval preferred
by the publisher.

if CHIP_ICD_SUBSCRIPTION_HANDLING

config CHIP_MAX_PREFERRED_SUBSCRIPTION_REPORT_INTERVAL
int "Maximum preferred interval of sending subscription reports (s)"
default 60
help
Provides maximum preferred interval to be used by a publisher for negotiation
of the final maximum subscription report interval, after receiving a subscription
request from the initiator. This value should be selected as a compromise between
keeping the power consumption low due to not sending reports too often, and allowing
the initiator device to detect the publisher absence reasonably fast due to not sending
the reports too rarely. The current algorithm is to select bigger value from the one
requested by the initiator and the one preferred by the publisher.

endif # CHIP_ICD_SUBSCRIPTION_HANDLING

endif # CHIP
65 changes: 47 additions & 18 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -323,37 +323,66 @@ config CHIP_ENABLE_DNS_CLIENT
help
Enables using the OpenThread DNS client for the Matter service discovery.

config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
bool "Thread Sleepy End Device support"
config CHIP_ENABLE_ICD_SUPPORT
bool "Matter Intermittently Connected Devices support"
default n
depends on OPENTHREAD_MTD
imply OPENTHREAD_MTD_SED
imply OPENTHREAD_MTD_SED if NET_L2_OPENTHREAD
help
Enables the Thread Sleepy End Device (SED) support in Matter.
Enables the Intermittently Connected Device (ICD) support in Matter.

if CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
if CHIP_ENABLE_ICD_SUPPORT

config CHIP_SED_IDLE_INTERVAL
int "Sleepy End Device idle interval (ms)"
config CHIP_ICD_SLOW_POLL_INTERVAL
int "Intermittently Connected Device slow polling interval (ms)"
default 1000
help
Provides the Sleepy End Device wake interval in milliseconds while the
device is idle (which means that there is no active exchange to or from
the device, and its commissioning window is closed).
Provides the Intermittently Connected Device slow polling interval in milliseconds while the
device is in the idle mode. It determines the fastest frequency at which the device will be able
to receive the messages in the idle mode.

config CHIP_SED_ACTIVE_INTERVAL
int "Sleepy End Device active interval (ms)"
config CHIP_ICD_FAST_POLLING_INTERVAL
int "Intermittently Connected Device fast polling interval (ms)"
default 200
help
Provides the Sleepy End Device wake interval in milliseconds while the
device is active (which means that there is an active exchange to or from
the device, or its commissioning window is open).
Provides the Intermittently Connected Device fast polling interval in milliseconds while the
device is in the active mode. It determines the fastest frequency at which the device will be able
to receive the messages in the active mode. The CHIP_ICD_FAST_POLLING_INTERVAL shall be smaller than
CHIP_ICD_ACTIVE_MODE_INTERVAL.

endif # CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
config CHIP_ICD_IDLE_MODE_INTERVAL
int "Intermittently Connected Device idle mode interval (s)"
default 120
help
Provides the Intermittently Connected Device idle mode interval is seconds.
It determines the maximum amount of time the device can stay in the idle mode, which means the
device may be unreachable and not able to receive messages.

config CHIP_ICD_ACTIVE_MODE_INTERVAL
int "Intermittently Connected Device active mode interval (ms)"
default 300
help
Provides the Intermittently Connected Device active mode interval is milliseconds.
It determines the minimum amount of time the device shall stay in the active mode.

config CHIP_ICD_ACTIVE_MODE_THRESHOLD
int "Intermittently Connected Device active mode threshold (ms)"
default 300
help
Provides the Intermittently Connected Device active mode threshold is milliseconds.
It determines the minimum amount of time the device shall stay in the active mode after the network activity.

config CHIP_ICD_CLIENTS_PER_FABRIC
int "Intermittently Connected Device number of clients per fabric"
default 2
help
Provides the Intermittently Connected Device number of clients per fabric. It determines the maximum number
of clients per fabric that can be registered to receive notification from a device if their subscription is lost.

endif # CHIP_ENABLE_ICD_SUPPORT

config CHIP_THREAD_SSED
bool "Enable Thread Synchronized Sleepy End Device support"
depends on OPENTHREAD_CSL_RECEIVER && CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
depends on OPENTHREAD_CSL_RECEIVER && CHIP_ENABLE_ICD_SUPPORT
help
Enables the Thread Synchronized Sleepy End Device support in Matter.

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/nrfconnect_examples_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ You can enable the support for Thread Sleepy End Device in Matter by setting the
following Kconfig options:

- `CONFIG_OPENTHREAD_MTD`
- `CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT`
- `CONFIG_CHIP_ENABLE_ICD_SUPPORT`

The following Kconfig options can be used to tune Thread Sleepy End Device wake
intervals:

- `CONFIG_CHIP_SED_IDLE_INTERVAL`
- `CONFIG_CHIP_SED_ACTIVE_INTERVAL`
- `CONFIG_CHIP_ICD_SLOW_POLL_INTERVAL`
- `CONFIG_CHIP_ICD_FAST_POLLING_INTERVAL`

#### Commissioning with NFC support

Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-minimal-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CONFIG_GPIO=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
4 changes: 0 additions & 4 deletions examples/light-switch-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ if(CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp)
endif()

if(CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING)
target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/ICDUtil.cpp)
endif()

chip_configure_data_model(app
INCLUDE_SERVER
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../light-switch-common/light-switch-app.zap
Expand Down
5 changes: 1 addition & 4 deletions examples/light-switch-app/nrfconnect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ choice OPENTHREAD_DEVICE_TYPE
default OPENTHREAD_MTD
endchoice

config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
config CHIP_ENABLE_ICD_SUPPORT
bool
default y

Expand All @@ -47,9 +47,6 @@ config NRF_WIFI_LOW_POWER

endif # CHIP_WIFI

config CHIP_ICD_SUBSCRIPTION_HANDLING
default y

rsource "../../../config/nrfconnect/chip-module/Kconfig.features"
rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
8 changes: 0 additions & 8 deletions examples/light-switch-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
#include "OTAUtil.h"
#endif

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
#include <app/InteractionModelEngine.h>
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
Expand Down Expand Up @@ -229,10 +225,6 @@ CHIP_ERROR AppTask::Init()
ConfigurationMgr().LogDeviceConfig();
PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE));

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&GetICDUtil());
#endif

// Add CHIP event handler and start CHIP thread.
// Note that all the initialization code should happen prior to this point
// to avoid data races between the main and the CHIP threads.
Expand Down
4 changes: 0 additions & 4 deletions examples/light-switch-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#include "DFUOverSMP.h"
#endif

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
#include "ICDUtil.h"
#endif

#include <cstdint>

struct k_timer;
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
4 changes: 0 additions & 4 deletions examples/lock-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,3 @@ endif()
if(CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp)
endif()

if(CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING)
target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/ICDUtil.cpp)
endif()
5 changes: 1 addition & 4 deletions examples/lock-app/nrfconnect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ choice OPENTHREAD_DEVICE_TYPE
default OPENTHREAD_MTD
endchoice

config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
config CHIP_ENABLE_ICD_SUPPORT
bool
default y

Expand All @@ -59,9 +59,6 @@ config NRF_WIFI_LOW_POWER

endif # CHIP_WIFI

config CHIP_ICD_SUBSCRIPTION_HANDLING
default y

rsource "../../../config/nrfconnect/chip-module/Kconfig.features"
rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
8 changes: 0 additions & 8 deletions examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
#include "OTAUtil.h"
#endif

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
#include <app/InteractionModelEngine.h>
#endif

#include <dk_buttons_and_leds.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
Expand Down Expand Up @@ -222,10 +218,6 @@ CHIP_ERROR AppTask::Init()
ConfigurationMgr().LogDeviceConfig();
PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE));

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&GetICDUtil());
#endif

// Add CHIP event handler and start CHIP thread.
// Note that all the initialization code should happen prior to this point to avoid data races
// between the main and the CHIP threads.
Expand Down
4 changes: 0 additions & 4 deletions examples/lock-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
#include "DFUOverSMP.h"
#endif

#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING
#include "ICDUtil.h"
#endif

struct k_timer;
struct Identify;

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_ENABLE_ICD_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
2 changes: 1 addition & 1 deletion examples/ota-requestor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_ENABLE_ICD_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down
40 changes: 0 additions & 40 deletions examples/platform/nrfconnect/util/ICDUtil.cpp

This file was deleted.

Loading

0 comments on commit b1a3ada

Please sign in to comment.