Merge pull request #3 from jh8801-jung/master
author정지훈/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jh8801.jung@samsung.com>
Thu, 25 Mar 2021 08:19:11 +0000 (17:19 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 25 Mar 2021 08:19:11 +0000 (17:19 +0900)
Apply upstream code (2021-03-25)

257 files changed:
config/efr32/lib/pw_rpc/BUILD.gn
config/esp32/components/chip/CMakeLists.txt
config/esp32/components/chip/Kconfig
docs/guides/linux_thread_connectivity.md [deleted file]
docs/guides/openthread_border_router_pi.md [new file with mode: 0644]
docs/images/linux_thread_connectivity.svg [deleted file]
examples/all-clusters-app/all-clusters-common/gen/IMClusterCommandHandler.cpp
examples/all-clusters-app/all-clusters-common/gen/attribute-id.h
examples/all-clusters-app/all-clusters-common/gen/call-command-handler.cpp
examples/all-clusters-app/all-clusters-common/gen/callback-stub.cpp
examples/all-clusters-app/all-clusters-common/gen/callback.h
examples/all-clusters-app/all-clusters-common/gen/client-command-macro.h
examples/all-clusters-app/all-clusters-common/gen/cluster-id.h
examples/all-clusters-app/all-clusters-common/gen/command-id.h
examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h
examples/all-clusters-app/all-clusters-common/gen/gen_config.h
examples/all-clusters-app/all-clusters-common/gen/print-cluster.h
examples/all-clusters-app/esp32/CMakeLists.txt
examples/all-clusters-app/esp32/README.md
examples/all-clusters-app/esp32/main/CMakeLists.txt
examples/all-clusters-app/esp32/sdkconfig.defaults
examples/chip-tool/README.md
examples/chip-tool/commands/clusters/Commands.h
examples/chip-tool/commands/reporting/Commands.h
examples/chip-tool/config/PersistentStorage.cpp
examples/chip-tool/config/PersistentStorage.h
examples/chip-tool/gen/CHIPClientCallbacks.cpp
examples/chip-tool/gen/CHIPClientCallbacks.h
examples/chip-tool/gen/CHIPClustersObjc.h
examples/chip-tool/gen/CHIPClustersObjc.mm
examples/chip-tool/gen/IMClusterCommandHandler.cpp
examples/chip-tool/gen/attribute-id.h
examples/chip-tool/gen/call-command-handler.cpp
examples/chip-tool/gen/callback-stub.cpp
examples/chip-tool/gen/callback.h
examples/chip-tool/gen/client-command-macro.h
examples/chip-tool/gen/cluster-id.h
examples/chip-tool/gen/command-id.h
examples/chip-tool/gen/endpoint_config.h
examples/chip-tool/gen/gen_config.h
examples/chip-tool/gen/print-cluster.h
examples/chip-tool/templates/commands.zapt
examples/chip-tool/templates/reporting-commands.zapt
examples/common/pigweed/BUILD.gn
examples/common/pigweed/RpcService.cpp
examples/lighting-app/efr32/BUILD.gn
examples/lighting-app/efr32/include/CHIPProjectConfig.h
examples/lighting-app/efr32/src/main.cpp
examples/lighting-app/nrfconnect/main/include/CHIPProjectConfig.h
examples/lock-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h
examples/lock-app/efr32/BUILD.gn
examples/lock-app/efr32/include/CHIPProjectConfig.h
examples/lock-app/efr32/src/main.cpp
examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h
examples/persistent-storage/KeyValueStorageTest.cpp
examples/persistent-storage/efr32/include/CHIPProjectConfig.h
examples/persistent-storage/esp32/CMakeLists.txt [new file with mode: 0644]
examples/persistent-storage/esp32/README.md
examples/persistent-storage/esp32/main/CMakeLists.txt [new file with mode: 0644]
examples/persistent-storage/esp32/sdkconfig.defaults
examples/pigweed-app/efr32/BUILD.gn
examples/pigweed-app/efr32/include/CHIPProjectConfig.h
examples/pigweed-app/esp32/sdkconfig.defaults
examples/platform/k32w/app/project_include/CHIPProjectConfig.h
examples/platform/qpg6100/project_include/CHIPProjectConfig.h
examples/shell/nrfconnect/CHIPProjectConfig.h
examples/shell/nrfconnect/CMakeLists.txt
examples/shell/shell_common/cmd_device.cpp
examples/shell/shell_common/cmd_ping.cpp
examples/shell/standalone/main.cpp
examples/temperature-measurement-app/esp32/CMakeLists.txt [new file with mode: 0644]
examples/temperature-measurement-app/esp32/README.md
examples/temperature-measurement-app/esp32/main/CMakeLists.txt [new file with mode: 0644]
examples/temperature-measurement-app/esp32/sdkconfig.defaults
examples/tv-app/tv-common/gen/CHIPClustersObjc.mm
examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp
examples/tv-app/tv-common/gen/attribute-id.h
examples/tv-app/tv-common/gen/call-command-handler.cpp
examples/tv-app/tv-common/gen/callback-stub.cpp
examples/tv-app/tv-common/gen/callback.h
examples/tv-app/tv-common/gen/client-command-macro.h
examples/tv-app/tv-common/gen/cluster-id.h
examples/tv-app/tv-common/gen/command-id.h
examples/tv-app/tv-common/gen/endpoint_config.h
examples/tv-app/tv-common/gen/gen_config.h
examples/tv-app/tv-common/gen/print-cluster.h
scripts/requirements.in
scripts/requirements.txt
src/BUILD.gn
src/app/Command.cpp
src/app/Command.h
src/app/CommandHandler.cpp
src/app/CommandSender.cpp
src/app/InteractionModelEngine.cpp
src/app/chip-zcl-zpro-codec-api.h
src/app/clusters/color-control-server/color-control-server.cpp
src/app/clusters/level-control/level-control.cpp
src/app/clusters/network-commissioning/network-commissioning.cpp
src/app/clusters/on-off-server/on-off.cpp
src/app/encoder.cpp
src/app/reporting/reporting.cpp
src/app/server/Mdns.cpp
src/app/server/RendezvousServer.cpp
src/app/server/RendezvousServer.h
src/app/server/Server.cpp
src/app/util/CHIPDeviceCallbacksMgr.cpp
src/app/util/attribute-table.cpp
src/app/util/process-global-message.cpp
src/app/util/util.cpp
src/app/zap-templates/templates/app/CHIPClustersObjc-src.zapt
src/app/zap-templates/templates/app/endpoint_config.zapt
src/app/zap-templates/templates/chip/CHIPClusters-src.zapt
src/app/zap-templates/templates/chip/python-ChipDeviceController-ClusterCommands.zapt
src/app/zap-templates/zcl/content-launch-cluster.xml
src/app/zap-templates/zcl/media-playback-cluster.xml
src/ble/BLEEndPoint.cpp
src/controller/CHIPClusters.cpp
src/controller/CHIPClusters.h
src/controller/CHIPDevice.cpp
src/controller/CHIPDeviceController.cpp
src/controller/CHIPDeviceController.h
src/controller/DeviceAddressUpdater.cpp
src/controller/java/AndroidDeviceControllerWrapper.cpp
src/controller/java/AndroidDeviceControllerWrapper.h
src/controller/java/CHIPDeviceController-JNI.cpp
src/controller/python/ChipDeviceController-ClusterCommands.cpp
src/controller/python/ChipDeviceController-ScriptBinding.cpp
src/controller/python/ChipDeviceController-StorageDelegate.cpp
src/controller/python/ChipDeviceController-StorageDelegate.h
src/controller/python/README.md
src/controller/python/chip/ChipCluster.py
src/controller/python/chip/ble/LinuxImpl.cpp
src/controller/python/chip/ble/darwin/AdapterListing.mm
src/controller/python/chip/ble/darwin/Scanning.mm
src/controller/python/chip/internal/CommissionerImpl.cpp
src/credentials/CHIPCert.cpp
src/credentials/CHIPCertFromX509.cpp
src/credentials/CHIPCertToX509.cpp
src/darwin/Framework/CHIP/CHIPError.h
src/darwin/Framework/CHIP/CHIPError.mm
src/darwin/Framework/CHIP/CHIPPersistentStorageDelegateBridge.h
src/darwin/Framework/CHIP/CHIPPersistentStorageDelegateBridge.mm
src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.cpp
src/darwin/Framework/CHIP/gen/CHIPClientCallbacks.h
src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h
src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm
src/darwin/Framework/CHIP/gen/IMClusterCommandHandler.cpp
src/darwin/Framework/CHIP/gen/attribute-id.h
src/darwin/Framework/CHIP/gen/call-command-handler.cpp
src/darwin/Framework/CHIP/gen/callback-stub.cpp
src/darwin/Framework/CHIP/gen/callback.h
src/darwin/Framework/CHIP/gen/client-command-macro.h
src/darwin/Framework/CHIP/gen/cluster-id.h
src/darwin/Framework/CHIP/gen/command-id.h
src/darwin/Framework/CHIP/gen/endpoint_config.h
src/darwin/Framework/CHIP/gen/gen_config.h
src/darwin/Framework/CHIP/gen/print-cluster.h
src/inet/TCPEndPoint.cpp
src/inet/TCPEndPoint.h
src/inet/tests/TestInetLayer.cpp
src/lib/asn1/ASN1Writer.cpp
src/lib/core/CHIPCircularTLVBuffer.cpp
src/lib/core/CHIPKeyIds.cpp
src/lib/core/CHIPPersistentStorageDelegate.h
src/lib/core/CHIPTLVDebug.cpp
src/lib/core/CHIPTLVReader.cpp
src/lib/core/CHIPTLVUpdater.cpp
src/lib/core/CHIPTLVWriter.cpp
src/lib/core/CHIPVendorIdentifiers.hpp
src/lib/core/Optional.h
src/lib/core/tests/TestCHIPTLV.cpp
src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
src/lib/mdns/BUILD.gn
src/lib/mdns/Discovery_ImplPlatform.cpp
src/lib/mdns/ServiceNaming.cpp [new file with mode: 0644]
src/lib/mdns/ServiceNaming.h [new file with mode: 0644]
src/lib/mdns/minimal/ResponseSender.cpp
src/lib/mdns/minimal/Server.cpp
src/lib/support/BUILD.gn
src/lib/support/BitFlags.h
src/lib/support/CodeUtils.h
src/lib/support/PrivateHeap.cpp [new file with mode: 0644]
src/lib/support/PrivateHeap.h [new file with mode: 0644]
src/lib/support/ReturnMacros.h [deleted file]
src/lib/support/tests/BUILD.gn
src/lib/support/tests/TestPrivateHeap.cpp [new file with mode: 0644]
src/messaging/ExchangeACL.h
src/messaging/ExchangeContext.cpp
src/messaging/ExchangeContext.h
src/messaging/ExchangeMgr.cpp
src/messaging/ExchangeMgr.h
src/messaging/MessageCounterSync.cpp
src/messaging/MessageCounterSync.h
src/messaging/tests/MessagingContext.cpp
src/messaging/tests/TestChannel.cpp
src/messaging/tests/TestExchangeMgr.cpp
src/messaging/tests/TestMessageCounterSyncMgr.cpp
src/messaging/tests/TestReliableMessageProtocol.cpp
src/platform/BUILD.gn
src/platform/Darwin/MdnsError.cpp [new file with mode: 0644]
src/platform/Darwin/MdnsError.h [new file with mode: 0644]
src/platform/Darwin/MdnsImpl.cpp [new file with mode: 0644]
src/platform/Darwin/MdnsImpl.h [new file with mode: 0644]
src/platform/EFR32/BLEManagerImpl.cpp
src/platform/EFR32/BLEManagerImpl.h
src/platform/ESP32/PlatformManagerImpl.cpp
src/platform/ESP32/nimble/BLEManagerImpl.cpp
src/platform/Linux/BLEManagerImpl.cpp
src/platform/Linux/BLEManagerImpl.h
src/platform/Linux/CHIPDevicePlatformEvent.h
src/platform/Linux/PlatformManagerImpl.cpp
src/platform/Linux/ThreadStackManagerImpl.cpp
src/platform/Linux/bluez/ChipDeviceScanner.cpp
src/platform/Linux/bluez/Helper.cpp
src/platform/Linux/bluez/Helper.h
src/platform/Linux/bluez/Types.h
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp
src/platform/Zephyr/KeyValueStoreManagerImpl.cpp
src/platform/device.gni
src/platform/tests/BUILD.gn
src/protocols/BUILD.gn
src/protocols/Protocols.h
src/protocols/bdx/BUILD.gn
src/protocols/bdx/BdxMessages.h
src/protocols/bdx/BdxTransferSession.cpp
src/protocols/bdx/tests/TestBdxTransferSession.cpp
src/protocols/echo/Echo.h
src/protocols/interaction_model/Constants.h
src/protocols/secure_channel/BUILD.gn [new file with mode: 0644]
src/protocols/secure_channel/Constants.h
src/protocols/secure_channel/StatusReport.cpp [new file with mode: 0644]
src/protocols/secure_channel/StatusReport.h [new file with mode: 0644]
src/protocols/secure_channel/tests/BUILD.gn [new file with mode: 0644]
src/protocols/secure_channel/tests/TestStatusReport.cpp [new file with mode: 0644]
src/setup_payload/QRCodeSetupPayloadParser.cpp
src/system/SystemPacketBuffer.cpp
src/system/SystemPacketBuffer.h
src/transport/AdminPairingTable.cpp
src/transport/BLE.cpp
src/transport/CASESession.cpp
src/transport/NetworkProvisioning.cpp
src/transport/NetworkProvisioning.h
src/transport/PASESession.cpp
src/transport/RendezvousSession.cpp
src/transport/RendezvousSession.h
src/transport/SecureMessageCodec.cpp
src/transport/SecureSession.cpp
src/transport/SecureSessionMgr.cpp
src/transport/StorablePeerConnection.cpp
src/transport/raw/MessageHeader.cpp
src/transport/raw/MessageHeader.h
src/transport/raw/TCP.cpp
src/transport/raw/TCP.h
src/transport/raw/UDP.cpp
src/transport/raw/tests/TestMessageHeader.cpp
src/transport/raw/tests/TestTCP.cpp
src/transport/tests/TestSecureSessionMgr.cpp

index e79df99..484b7cc 100644 (file)
@@ -32,7 +32,7 @@ static_library("pw_rpc") {
 
   public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ]
 
-  deps = [
+  public_deps = [
     "$dir_pw_rpc:server",
     "$dir_pw_rpc/nanopb:echo_service",
     "${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32",
index f002578..e9b47ba 100644 (file)
@@ -32,11 +32,6 @@ endif()
 idf_component_register(SRCS chip.c chip.cpp
                        PRIV_REQUIRES freertos lwip bt mdns mbedtls)
 
-# Override some build specifications
-set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
-set(CMAKE_BUILD_TYPE MinSizeRel)
-target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
-
 # Prepare initial args file (lacking compile flags)
 # This will be saved as args.gn.in
 set(chip_gn_args "import(\"//args.gni\")\n")
@@ -52,10 +47,10 @@ chip_gn_arg_append("esp32_cpu"             "\"esp32\"")
 
 if(CONFIG_ENABLE_PW_RPC)
     chip_gn_arg_append("chip_build_pw_rpc_lib"              "true")
-    chip_gn_arg_append("pw_log_BACKEND"                     "true")
-    chip_gn_arg_append("pw_assert_BACKEND"                  "true")
-    chip_gn_arg_append("pw_sys_io_BACKEND"                  "true")
-    chip_gn_arg_append("dir_pw_third_party_nanopb"          "true")
+    chip_gn_arg_append("pw_log_BACKEND"                     "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic\"")
+    chip_gn_arg_append("pw_assert_BACKEND"                  "\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log\"")
+    chip_gn_arg_append("pw_sys_io_BACKEND"                  "\"//third_party/connectedhomeip/examples/platform/esp32/pw_sys_io:pw_sys_io_esp32\"")
+    chip_gn_arg_append("dir_pw_third_party_nanopb"          "\"//third_party/connectedhomeip/third_party/nanopb/repo\"")
 endif()
 
 set(args_gn_input "${CMAKE_CURRENT_BINARY_DIR}/args.gn.in")
@@ -109,7 +104,7 @@ externalproject_add(
     chip_gn
     SOURCE_DIR              ${CHIP_ROOT}
     BINARY_DIR              ${CMAKE_CURRENT_BINARY_DIR}
-    CONFIGURE_COMMAND       gn --root=${GN_ROOT_TARGET} gen --check --fail-on-unused-args ${CMAKE_CURRENT_BINARY_DIR}
+    CONFIGURE_COMMAND       ${GN_EXECUTABLE} --root=${GN_ROOT_TARGET} gen --check --fail-on-unused-args ${CMAKE_CURRENT_BINARY_DIR}
     BUILD_COMMAND           ninja
     INSTALL_COMMAND         ""
     BUILD_BYPRODUCTS        ${CHIP_LIBRARIES}
@@ -138,7 +133,6 @@ target_include_directories(${COMPONENT_LIB} INTERFACE
     "${CMAKE_CURRENT_BINARY_DIR}/gen/include"
 )
 
-idf_component_get_property(bt_lib bt COMPONENT_LIB)
 idf_component_get_property(esp32_mbedtls_lib esp32_mbedtls COMPONENT_LIB)
 
 set(chip_libraries "-lCHIP")
@@ -147,12 +141,16 @@ if(CONFIG_ENABLE_PW_RPC)
     list(APPEND chip_libraries "-lPwRpc")
 endif()
 
+if(CONFIG_BT_ENABLED)
+    idf_component_get_property(bt_lib bt COMPONENT_LIB)
+    list(APPEND chip_libraries $<TARGET_FILE:${bt_lib}> -lbtdm_app)
+endif()
+
 target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_BINARY_DIR}/lib")
 target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group 
                                                 ${chip_libraries}
-                                                $<TARGET_FILE:${bt_lib}> -lbtdm_app 
                                                 $<TARGET_FILE:mbedcrypto> $<TARGET_FILE:${esp32_mbedtls_lib}> 
                                                 -Wl,--end-group)
 
 # Make the component dependent on our CHIP build
-add_dependencies(${COMPONENT_LIB} chip_gn)
\ No newline at end of file
+add_dependencies(${COMPONENT_LIB} chip_gn)
index f414b7c..551a7dc 100644 (file)
@@ -508,32 +508,32 @@ menu "CHIP Device Layer"
                 may need to be shorter.
 
         config BLE_FAST_ADVERTISING_INTERVAL_MIN
-            int "Fast Advertising Interval"
-            default 32
+            int "Fast Advertising Min Interval"
+            default 40
             depends on ENABLE_CHIPOBLE
             help
                 The minimum interval (in units of 0.625ms) at which the device will send BLE advertisements while
                 in fast advertising mode.
 
         config BLE_FAST_ADVERTISING_INTERVAL_MAX
-            int "Fast Advertising Interval"
-            default 96
+            int "Fast Advertising Max Interval"
+            default 40
             depends on ENABLE_CHIPOBLE
             help
                 The maximum interval (in units of 0.625ms) at which the device will send BLE advertisements while
                 in fast advertising mode.
 
         config BLE_SLOW_ADVERTISING_INTERVAL_MIN
-            int "Slow Advertising Interval"
-            default 240
+            int "Slow Advertising Min Interval"
+            default 800
             depends on ENABLE_CHIPOBLE
             help
                 The minimum interval (in units of 0.625ms) at which the device will send BLE advertisements while
                 in slow advertising mode.
 
         config BLE_SLOW_ADVERTISING_INTERVAL_MAX
-            int "Slow Advertising Interval"
-            default 1920
+            int "Slow Advertising Max Interval"
+            default 800
             depends on ENABLE_CHIPOBLE
             help
                 The maximum interval (in units of 0.625ms) at which the device will send BLE advertisements while
diff --git a/docs/guides/linux_thread_connectivity.md b/docs/guides/linux_thread_connectivity.md
deleted file mode 100644 (file)
index 70befba..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-# Configuring Thread network on a Linux machine
-
-You can use a Project CHIP controller such as
-[Python CHIP Controller](../../src/controller/python/README.md) to control
-Thread devices enabled for Project CHIP from a Linux host.
-
-For this purpose, you must equip the host with a Thread radio device, create a
-new Thread network, and ensure that packets addressed to devices within the
-network are routed through the radio device.
-
-<hr>
-
--   [Overview](#overview)
--   [Requirements](#requirements)
--   [Configuration](#configuration)
--   [Preparing OpenThread Radio Co-Processor device](#preparing-openthread-radio-co-processor)
--   [Configuring OpenThread Border Router](#configuring-openthread-border-router)
--   [Testing](#testing)
-
-<hr>
-
-## Overview
-
-The following figure shows the setup created as a result of configuring Thread
-network on a Linux machine.
-
-![linux_thread_connectivity](../images/linux_thread_connectivity.svg)
-
-In this setup, the connectivity between Python CHIP Controller and Thread
-devices is ensured in the following way:
-
--   CHIP messages generated by the Project CHIP controller are routed through a
-    virtual network interface **otbr0** to
-    [OpenThread Border Router container](https://openthread.io/guides/border-router/docker)
-    in Docker.
--   The OpenThread Border Router container uses a device with the
-    [OpenThread Radio Co-Processor](https://openthread.io/platforms/co-processor)
-    firmware to transmit Project CHIP messages to the Thread network.
--   CHIP-enabled Thread devices connected to the same Thread network receive and
-    consume Project CHIP messages.
-
-<hr>
-
-## Requirements
-
-You need the following hardware and software for this configuration:
-
--   OpenThread Radio Co-Processor device (for example,
-    [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52840-Dongle),
-    [Thunderboard Sense 2](https://www.silabs.com/development-tools/thunderboard/thunderboard-sense-two-kit))
--   Linux machine with Ubuntu v20.04 or later
-
-<hr>
-
-## Configuration
-
-The configuration process is composed of the following steps:
-
--   Preparing OpenThread Radio Co-Processor (RCP) device
--   Configuring OpenThread Border Router container in Docker
-
-### Configuring OpenThread Radio Co-Processor
-
-#### On Nordic Hardware
-
-> Read
-> [Configuring OpenThread Radio Co-processor on nRF52840 Dongle](openthread_rcp_nrf_dongle.md)
-> to learn how to configure Nordic Semiconductor's
-> [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52840-Dongle)
-> as OpenThread Radio Co-Processor.
-
-#### On Silicon Labs Hardware
-
-> Please refer to this
-> [guide](https://www.silabs.com/documents/public/application-notes/an1256-using-sl-rcp-with-openthread-border-router.pdf)
-> to configure the OpenThread Radio Co-Processor on the Thunderboard sense 2.
-
-You can replace the nRF52840 Dongle or the Thunderboard with a variety of
-development boards from different vendors. If you are using a Raspberry Pi as
-your testing platform, you can execute this step on a more powerful Linux
-machine to shorten the firmware build time.
-
-### Configuring OpenThread Border Router
-
-To configure OpenThread Border Router, complete the following steps:
-
-1.  Install Docker daemon:
-
-        $ sudo apt update && sudo apt install docker.io
-
-2.  Start the Docker daemon:
-
-        $ sudo systemctl start docker
-
-3.  Create an IPv6 network for the OpenThread Border Router container in Docker:
-
-        $ sudo docker network create --ipv6 --subnet fd11:db8:1::/64 -o com.docker.network.bridge.name=otbr0 otbr
-
-4.  Start the OpenThread Border Router container using the following command (in
-    the last line, replace _/dev/ttyACM0_ with the device node name of the
-    OpenThread Radio Co-processor):
-
-        $ sudo docker run -it --rm --privileged --network otbr -p 8080:80 -e NAT64=0 -e DNS64=0 \
-                --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" \
-                --volume /dev/ttyACM0:/dev/radio openthread/otbr --radio-url spinel+hdlc+uart:///dev/radio
-
-5.  Open the `http://localhost:8080/` address in a web browser. If you are using
-    a Raspberry Pi without a screen, but you have a different device in the same
-    network, you can start a web browser on that device and use the address of
-    the Raspberry Pi instead of `localhost`.
-6.  Click **Form** in the menu to the left. The network forming creator window
-    appears.
-7.  Make sure that the On-Mesh Prefix is set to `fd11:22::`. This value is used
-    later to configure the IPv6 packet routing.
-8.  Click the **Form** button at the bottom of the window to form a new Thread
-    network using the default settings.
-9.  To ensure that packets addressed to devices in the Thread network are routed
-    through the OpenThread Border Router container in Docker, run the following
-    command with the On-Mesh Prefix that you set earlier:
-
-        $ sudo ip -6 route add fd11:22::/64 dev otbr0 via fd11:db8:1::2
-
-<hr>
-
-## Testing
-
-After Open Thread Border Router has been configured, complete the steps
-described in the
-[Python CHIP Controller README](../../src/controller/python/README.md) to
-commission a Thread device into the network and control it using the Project
-CHIP protocol.
diff --git a/docs/guides/openthread_border_router_pi.md b/docs/guides/openthread_border_router_pi.md
new file mode 100644 (file)
index 0000000..a820723
--- /dev/null
@@ -0,0 +1,34 @@
+# Setup OpenThread Border Router on Raspberry Pi
+
+![OTBR](https://openthread.io/codelabs/openthread-border-router/img/699d673d05a55535.png)
+
+A Thread Border Router connects a Thread network to other IP-based networks,
+such as Wi-Fi or Ethernet. A Thread network requires a Border Router to connect
+to other networks. A Thread Border Router minimally supports the following
+functions:
+
+-   Bidirectional IP connectivity between Thread and Wi-Fi/Ethernet networks.
+-   Bidirectional service discovery via mDNS (on Wi-Fi/Ethernet link) and SRP
+    (on Thread network).
+-   Thread-over-infrastructure that merges Thread partitions over IP-based
+    links.
+-   External Thread Commissioning (for example, a mobile phone) to authenticate
+    and join a Thread device to a Thread network.
+
+[OpenThread Border Router](https://openthread.io/guides/border-router) (OTBR)
+released by Google is an open-source implementation of the Thread Border Router.
+
+## Setup
+
+**Follow [this CodeLab](https://openthread.io/codelabs/openthread-border-router)
+to set up your OpenThread Border Router on a Raspberry Pi 3/4 device!**
+
+> Ubuntu and debian hosts are also supported!
+
+The CodeLab uses a Nordic nRF52840 DK as the Border Router RCP device.
+
+-   See [openthread_rcp_nrf_dongle.md](./openthread_rcp_nrf_dongle.md) for using
+    nRF52840 dongle as a RCP device.
+-   See this
+    [guide](https://www.silabs.com/documents/public/application-notes/an1256-using-sl-rcp-with-openthread-border-router.pdf)
+    for creating Silicon Labs RCP devices.
diff --git a/docs/images/linux_thread_connectivity.svg b/docs/images/linux_thread_connectivity.svg
deleted file mode 100644 (file)
index 75fc719..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generated by Microsoft Visio, SVG Export linux_thread_connectivity.svg Drawing -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="4.23943in"
-   height="5.23793in"
-   viewBox="0 0 305.239 377.131"
-   xml:space="preserve"
-   color-interpolation-filters="sRGB"
-   class="st10"
-   version="1.1"
-   id="svg105"
-   sodipodi:docname="linux_thread_connectivity.svg"
-   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
-   id="metadata109"><rdf:RDF><cc:Work
-       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
-         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
-   pagecolor="#ffffff"
-   bordercolor="#666666"
-   borderopacity="1"
-   objecttolerance="10"
-   gridtolerance="10"
-   guidetolerance="10"
-   inkscape:pageopacity="0"
-   inkscape:pageshadow="2"
-   inkscape:window-width="1920"
-   inkscape:window-height="1163"
-   id="namedview107"
-   showgrid="false"
-   inkscape:zoom="1.3274742"
-   inkscape:cx="247.77132"
-   inkscape:cy="268.19765"
-   inkscape:window-x="0"
-   inkscape:window-y="0"
-   inkscape:window-maximized="1"
-   inkscape:current-layer="g103" />
-       <style
-   type="text/css"
-   id="style2">
-       <![CDATA[
-               .st1 {fill:#768692;stroke:none;stroke-width:1}
-               .st2 {fill:#ffffff;font-family:Gotham Light;font-size:1.00001em}
-               .st3 {fill:#d9e1e2;stroke:none;stroke-width:1}
-               .st4 {fill:#333f48;font-family:Calibri;font-size:1.00001em}
-               .st5 {font-size:1em}
-               .st6 {marker-end:url(#mrkr13-19);stroke:#0033a0;stroke-linecap:butt;stroke-width:1}
-               .st7 {fill:#0033a0;fill-opacity:1;stroke:#0033a0;stroke-opacity:1;stroke-width:0.28409090909091}
-               .st8 {fill:#ffffff;stroke:none;stroke-linecap:butt;stroke-width:7.2}
-               .st9 {fill:#0033a0;font-family:Calibri;font-size:1.00001em}
-               .st10 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3}
-       ]]>
-       </style>
-
-       <defs
-   id="Markers">
-               <g
-   id="lend13">
-                       <path
-   d="M 3 1 L 0 0 L 3 -1 L 3 1 "
-   style="stroke:none"
-   id="path4" />
-               </g>
-               <marker
-   id="mrkr13-19"
-   class="st7"
-   refX="-10.56"
-   orient="auto"
-   markerUnits="strokeWidth"
-   overflow="visible">
-                       <use
-   xlink:href="#lend13"
-   transform="scale(-3.52,-3.52) "
-   id="use7" />
-               </marker>
-       </defs>
-       <g
-   id="g103">
-               <title
-   id="title11">Drawing</title>
-               <g
-   id="shape6-1"
-   transform="translate(19,-143.724)">
-                       <title
-   id="title13">Nordic Middle Grey</title>
-                       <desc
-   id="desc15">Linux machine (Raspberry Pi or other)</desc>
-                       <rect
-   x="0"
-   y="162.724"
-   width="267.239"
-   height="214.407"
-   class="st1"
-   id="rect17" />
-                       <text
-   x="20.52"
-   y="177.52"
-   class="st2"
-   id="text19">Linux machine (Raspberry Pi or other)</text>
-               </g>
-               <g
-   id="shape7-4"
-   transform="translate(32.1469,-293.961)">
-                       <title
-   id="title22">Nordic Light Grey</title>
-                       <desc
-   id="desc24">Controller (Python CHIP Controller)</desc>
-                       <rect
-   x="0"
-   y="339.126"
-   width="240.945"
-   height="38.0053"
-   class="st3"
-   id="rect26" />
-                       <text
-   x="121.36"
-   y="354.53"
-   class="st4"
-   id="text30"
-   style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.00000191px;font-family:Calibri;-inkscape-font-specification:'Calibri, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#333f48"><tspan
-     sodipodi:role="line"
-     id="tspan111"
-     x="121.36"
-     y="354.53">Controller</tspan><tspan
-     sodipodi:role="line"
-     id="tspan113"
-     x="121.36"
-     y="369.53">(Python CHIP Controller)</tspan></text>
-               </g>
-               <g
-   id="shape8-8"
-   transform="translate(32.1469,-227.609)">
-                       <title
-   id="title33">Nordic Light Grey.8</title>
-                       <desc
-   id="desc35">Virtual network interface (otbr0)</desc>
-                       <rect
-   x="0"
-   y="339.126"
-   width="240.945"
-   height="38.0053"
-   class="st3"
-   id="rect37" />
-                       <text
-   x="27.259998"
-   y="361.73001"
-   class="st4"
-   id="text39"
-   style="font-size:12.00012016px;font-family:Calibri;fill:#333f48">Virtual network interface (otbr0)</text>
-               </g>
-               <g
-   id="shape9-11"
-   transform="translate(32.1469,-160.732)">
-                       <title
-   id="title42">Nordic Light Grey.9</title>
-                       <desc
-   id="desc44">OpenThread Border Router Docker image</desc>
-                       <rect
-   x="0"
-   y="339.126"
-   width="240.945"
-   height="38.0053"
-   class="st3"
-   id="rect46" />
-                       <text
-   x="123.24924"
-   y="345.42401"
-   class="st4"
-   id="text48"
-   style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.00000165px;font-family:Calibri;-inkscape-font-specification:'Calibri, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr;text-anchor:middle;fill:#333f48;stroke-width:0.97102857;"
-   transform="scale(0.97102858,1.0298358)"><tspan
-     sodipodi:role="line"
-     id="tspan115"
-     x="123.24924"
-     y="345.42401">OpenThread Border Router</tspan><tspan
-     sodipodi:role="line"
-     id="tspan117"
-     x="123.24924"
-     y="359.98901">Docker container</tspan></text>
-               </g>
-               <g
-   id="shape10-14"
-   transform="translate(145.533,-293.961)">
-                       <title
-   id="title51">Dynamic connector</title>
-                       <path
-   d="M7.09 377.13 L7.09 394.92"
-   class="st6"
-   id="path53" />
-               </g>
-               <g
-   id="shape11-20"
-   transform="translate(145.533,-227.609)">
-                       <title
-   id="title56">Dynamic connector.11</title>
-                       <path
-   d="M7.09 377.13 L7.09 395.44"
-   class="st6"
-   id="path58" />
-               </g>
-               <g
-   id="shape12-25"
-   transform="translate(32.1469,-85.0367)">
-                       <title
-   id="title61">Nordic Light Grey.12</title>
-                       <desc
-   id="desc63">OpenThread Radio Co-Processor (on nRF52840 Dongle or other)</desc>
-                       <rect
-   x="0"
-   y="339.126"
-   width="240.945"
-   height="38.0053"
-   class="st3"
-   id="rect65" />
-                       <text
-   x="23.459999"
-   y="354.53"
-   class="st4"
-   id="text69"
-   style="font-size:12.00012016px;font-family:Calibri;fill:#333f48">OpenThread Radio Co-Processor <tspan
-   x="26.869999"
-   dy="14.400145"
-   class="st5"
-   id="tspan67"
-   style="font-size:12.00012016px">(nRF52840 Dongle/Thunderboard/etc...)</tspan></text>
-               </g>
-               <g
-   id="shape13-29"
-   transform="translate(32.1469,-19)">
-                       <title
-   id="title72">Nordic Light Grey.13</title>
-                       <desc
-   id="desc74">Thread device enabled for Project CHIP</desc>
-                       <rect
-   x="0"
-   y="339.126"
-   width="240.945"
-   height="38.0053"
-   class="st3"
-   id="rect76" />
-                       <text
-   x="121.13"
-   y="354.23001"
-   class="st4"
-   id="text78"
-   style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.00000191px;font-family:Calibri;-inkscape-font-specification:'Calibri, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#333f48"><tspan
-     sodipodi:role="line"
-     id="tspan119"
-     x="121.13"
-     y="354.23001">Thread device enabled</tspan><tspan
-     sodipodi:role="line"
-     id="tspan121"
-     x="121.13"
-     y="369.23001">for Project CHIP</tspan></text>
-               </g>
-               <g
-   id="shape14-32"
-   transform="translate(145.533,-85.0367)">
-                       <title
-   id="title81">Dynamic connector.14</title>
-                       <desc
-   id="desc83">Thread</desc>
-                       <path
-   d="M7.09 377.13 L7.09 394.6"
-   class="st6"
-   id="path85" />
-                       <rect
-   x="18.4487"
-   y="383.947"
-   width="34.3597"
-   height="14.4001"
-   class="st8"
-   id="rect87" />
-                       <text
-   x="18.45"
-   y="394.75"
-   class="st9"
-   id="text89">Thread</text>
-               </g>
-               <g
-   id="shape15-39"
-   transform="translate(145.533,-160.732)">
-                       <title
-   id="title92">Dynamic connector.15</title>
-                       <desc
-   id="desc94">USB</desc>
-                       <path
-   d="M7.09 377.13 L7.09 404.26"
-   class="st6"
-   id="path96" />
-                       <rect
-   x="17.4499"
-   y="397.28"
-   width="19.7405"
-   height="14.4001"
-   class="st8"
-   id="rect98" />
-                       <text
-   x="17.45"
-   y="408.08"
-   class="st9"
-   id="text100">USB</text>
-               </g>
-       </g>
-</svg>
\ No newline at end of file
index 13589c1..d7dc01c 100644 (file)
@@ -793,35 +793,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace ColorControl
 
-namespace ContentLaunch {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchContentCallback();
-            break;
-        }
-        case ZCL_LAUNCH_URL_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchURLCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace ContentLaunch
-
 namespace DoorLock {
 
 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -2152,75 +2123,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace LowPower
 
-namespace MediaPlayback {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterFastForwardRequestCallback();
-            break;
-        }
-        case ZCL_NEXT_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterNextRequestCallback();
-            break;
-        }
-        case ZCL_PAUSE_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPauseRequestCallback();
-            break;
-        }
-        case ZCL_PLAY_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPlayRequestCallback();
-            break;
-        }
-        case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPreviousRequestCallback();
-            break;
-        }
-        case ZCL_REWIND_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterRewindRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-            break;
-        }
-        case ZCL_START_OVER_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterStartOverRequestCallback();
-            break;
-        }
-        case ZCL_STOP_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterStopRequestCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace MediaPlayback
-
 namespace NetworkCommissioning {
 
 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -2871,9 +2773,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
@@ -2895,9 +2794,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     case ZCL_LOW_POWER_CLUSTER_ID:
         clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
         clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
index 6ca0739..0fd312a 100644 (file)
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Media Playback
+
+// Client attributes
+
+// Server attributes
+#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
+
 // Attribute ids for cluster: Low Power
 
 // Client attributes
 
 // Server attributes
 
+// Attribute ids for cluster: Content Launch
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
 
-// Attribute ids for cluster: Media Playback
-
-// Client attributes
-
-// Server attributes
-#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
-
-// Attribute ids for cluster: Content Launch
-
-// Client attributes
-
-// Server attributes
-
 // Attribute ids for cluster: Group Key Management
 
 // Client attributes
index b599d34..2ccd916 100644 (file)
@@ -33,7 +33,6 @@ EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterComma
 EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfBindingClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfContentLaunchClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGeneralCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGroupKeyManagementClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -42,7 +41,6 @@ EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cm
 EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfMediaPlaybackClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfNetworkCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -103,9 +101,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         case ZCL_COLOR_CONTROL_CLUSTER_ID:
             result = emberAfColorControlClusterServerCommandParse(cmd);
             break;
-        case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-            result = emberAfContentLaunchClusterServerCommandParse(cmd);
-            break;
         case ZCL_DOOR_LOCK_CLUSTER_ID:
             result = emberAfDoorLockClusterServerCommandParse(cmd);
             break;
@@ -131,9 +126,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         case ZCL_LOW_POWER_CLUSTER_ID:
             result = emberAfLowPowerClusterServerCommandParse(cmd);
             break;
-        case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-            result = emberAfMediaPlaybackClusterServerCommandParse(cmd);
-            break;
         case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
             result = emberAfNetworkCommissioningClusterServerCommandParse(cmd);
             break;
@@ -860,30 +852,6 @@ EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfContentLaunchClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
-            wasHandled = emberAfContentLaunchClusterLaunchContentCallback();
-            break;
-        }
-        case ZCL_LAUNCH_URL_COMMAND_ID: {
-            wasHandled = emberAfContentLaunchClusterLaunchURLCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
@@ -1845,62 +1813,6 @@ EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * c
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfMediaPlaybackClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterFastForwardRequestCallback();
-            break;
-        }
-        case ZCL_NEXT_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterNextRequestCallback();
-            break;
-        }
-        case ZCL_PAUSE_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPauseRequestCallback();
-            break;
-        }
-        case ZCL_PLAY_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPlayRequestCallback();
-            break;
-        }
-        case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPreviousRequestCallback();
-            break;
-        }
-        case ZCL_REWIND_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterRewindRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-            break;
-        }
-        case ZCL_START_OVER_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterStartOverRequestCallback();
-            break;
-        }
-        case ZCL_STOP_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterStopRequestCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfNetworkCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index 3b2561d..78c7710 100644 (file)
@@ -44,9 +44,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         emberAfColorControlClusterInitCallback(endpoint);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        emberAfContentLaunchClusterInitCallback(endpoint);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         emberAfDoorLockClusterInitCallback(endpoint);
         break;
@@ -71,9 +68,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_LOW_POWER_CLUSTER_ID:
         emberAfLowPowerClusterInitCallback(endpoint);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        emberAfMediaPlaybackClusterInitCallback(endpoint);
-        break;
     case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
         emberAfNetworkCommissioningClusterInitCallback(endpoint);
         break;
@@ -117,11 +111,6 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfContentLaunchClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -162,11 +151,6 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfMediaPlaybackClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index ac69b4a..d368a6e 100644 (file)
@@ -79,14 +79,6 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Content Launch Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Door Lock Cluster Init
  *
  * Cluster Init
@@ -151,14 +143,6 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Media Playback Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Network Commissioning Cluster Init
  *
  * Cluster Init
@@ -544,76 +528,6 @@ EmberAfStatus emberAfColorControlClusterServerPreAttributeChangedCallback(chip::
 void emberAfColorControlClusterServerTickCallback(chip::EndpointId endpoint);
 
 //
-// Content Launch Cluster server
-//
-
-/** @brief Content Launch Cluster Server Init
- *
- * Server Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterServerInitCallback(chip::EndpointId endpoint);
-
-/** @brief Content Launch Cluster Server Attribute Changed
- *
- * Server Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfContentLaunchClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Content Launch Cluster Server Manufacturer Specific Attribute Changed
- *
- * Server Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfContentLaunchClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Content Launch Cluster Server Message Sent
- *
- * Server Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Content Launch Cluster Server Pre Attribute Changed
- *
- * server Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfContentLaunchClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Content Launch Cluster Server Tick
- *
- * server Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfContentLaunchClusterServerTickCallback(chip::EndpointId endpoint);
-
-//
 // Door Lock Cluster server
 //
 
@@ -1176,76 +1090,6 @@ EmberAfStatus emberAfLowPowerClusterServerPreAttributeChangedCallback(chip::Endp
 void emberAfLowPowerClusterServerTickCallback(chip::EndpointId endpoint);
 
 //
-// Media Playback Cluster server
-//
-
-/** @brief Media Playback Cluster Server Init
- *
- * Server Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterServerInitCallback(chip::EndpointId endpoint);
-
-/** @brief Media Playback Cluster Server Attribute Changed
- *
- * Server Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfMediaPlaybackClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Media Playback Cluster Server Manufacturer Specific Attribute Changed
- *
- * Server Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfMediaPlaybackClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Media Playback Cluster Server Message Sent
- *
- * Server Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Media Playback Cluster Server Pre Attribute Changed
- *
- * server Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfMediaPlaybackClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Media Playback Cluster Server Tick
- *
- * server Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfMediaPlaybackClusterServerTickCallback(chip::EndpointId endpoint);
-
-//
 // Network Commissioning Cluster server
 //
 
@@ -1730,18 +1574,6 @@ bool emberAfColorControlClusterStepSaturationCallback(uint8_t stepMode, uint8_t
 bool emberAfColorControlClusterStopMoveStepCallback(uint8_t optionsMask, uint8_t optionsOverride);
 
 /**
- * @brief Content Launch Cluster LaunchContent Command callback
- */
-
-bool emberAfContentLaunchClusterLaunchContentCallback();
-
-/**
- * @brief Content Launch Cluster LaunchURL Command callback
- */
-
-bool emberAfContentLaunchClusterLaunchURLCallback();
-
-/**
  * @brief Door Lock Cluster ClearAllPins Command callback
  */
 
@@ -2098,66 +1930,6 @@ bool emberAfLevelControlClusterStopWithOnOffCallback();
 bool emberAfLowPowerClusterSleepCallback();
 
 /**
- * @brief Media Playback Cluster FastForwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterFastForwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster NextRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterNextRequestCallback();
-
-/**
- * @brief Media Playback Cluster PauseRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPauseRequestCallback();
-
-/**
- * @brief Media Playback Cluster PlayRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPlayRequestCallback();
-
-/**
- * @brief Media Playback Cluster PreviousRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPreviousRequestCallback();
-
-/**
- * @brief Media Playback Cluster RewindRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterRewindRequestCallback();
-
-/**
- * @brief Media Playback Cluster SkipBackwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster SkipForwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster StartOverRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterStartOverRequestCallback();
-
-/**
- * @brief Media Playback Cluster StopRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterStopRequestCallback();
-
-/**
  * @brief Network Commissioning Cluster AddThreadNetwork Command callback
  * @param operationalDataset
  * @param breadcrumb
index 79d1e15..775f29f 100644 (file)
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for PlayRequest
+ *
+ * Command: PlayRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PauseRequest
+ *
+ * Command: PauseRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
+                                                                                                                                   \
+                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StopRequest
+ *
+ * Command: StopRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StartOverRequest
+ *
+ * Command: StartOverRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
+                                                                                                                                   \
+                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PreviousRequest
+ *
+ * Command: PreviousRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
+                                                                                                                                   \
+                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for NextRequest
+ *
+ * Command: NextRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for RewindRequest
+ *
+ * Command: RewindRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
+                                                                                                                                   \
+                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for FastForwardRequest
+ *
+ * Command: FastForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipForwardRequest
+ *
+ * Command: SkipForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipBackwardRequest
+ *
+ * Command: SkipBackwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
+                                                                                                                                   \
+                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
+
 /** @brief Command description for Sleep
  *
  * Command: Sleep
                                                                                                                                    \
                                                   ZCL_SLEEP_COMMAND_ID, "", );
 
+/** @brief Command description for LaunchContent
+ *
+ * Command: LaunchContent
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
+        emberAfFillExternalBuffer(mask,                                                                                            \
+                                                                                                                                   \
+                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
+
+/** @brief Command description for LaunchURL
+ *
+ * Command: LaunchURL
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
+                                                                                                                                   \
+                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
                                                                                                                                    \
                               ZCL_UNBIND_COMMAND_ID, "uuuu", nodeId, groupId, endpointId, clusterId);
 
-/** @brief Command description for PlayRequest
- *
- * Command: PlayRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PauseRequest
- *
- * Command: PauseRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
-                                                                                                                                   \
-                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StopRequest
- *
- * Command: StopRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StartOverRequest
- *
- * Command: StartOverRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
-                                                                                                                                   \
-                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PreviousRequest
- *
- * Command: PreviousRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
-                                                                                                                                   \
-                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for NextRequest
- *
- * Command: NextRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for RewindRequest
- *
- * Command: RewindRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
-                                                                                                                                   \
-                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for FastForwardRequest
- *
- * Command: FastForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipForwardRequest
- *
- * Command: SkipForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipBackwardRequest
- *
- * Command: SkipBackwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
-                                                                                                                                   \
-                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for LaunchContent
- *
- * Command: LaunchContent
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
-        emberAfFillExternalBuffer(mask,                                                                                            \
-                                                                                                                                   \
-                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
-
-/** @brief Command description for LaunchURL
- *
- * Command: LaunchURL
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
-                                                                                                                                   \
-                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
-
 /** @brief Command description for CommandOne
  *
  * Command: CommandOne
index 9e82931..499adf9 100644 (file)
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Media Playback
+#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0x0506)
+
 // Definitions for cluster: Low Power
 #define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
 
+// Definitions for cluster: Content Launch
+#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0x050A)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
 // Definitions for cluster: Binding
 #define ZCL_BINDING_CLUSTER_ID (0xF000)
 
-// Definitions for cluster: Media Playback
-#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0xF001)
-
-// Definitions for cluster: Content Launch
-#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0xF002)
-
 // Definitions for cluster: Group Key Management
 #define ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID (0xF004)
 
index 864943b..268678a 100644 (file)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Media Playback
+#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
+#define ZCL_PLAYBACK_COMMAND_ID (0x00)
+#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
+#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
+#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
+#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
+#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
+#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
+#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
+#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
+#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
+
 // Commands for cluster: Low Power
 #define ZCL_SLEEP_COMMAND_ID (0x00)
 
+// Commands for cluster: Content Launch
+#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
+#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_BIND_COMMAND_ID (0x00)
 #define ZCL_UNBIND_COMMAND_ID (0x01)
 
-// Commands for cluster: Media Playback
-#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
-#define ZCL_PLAYBACK_COMMAND_ID (0x00)
-#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
-#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
-#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
-#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
-#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
-#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
-#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
-#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
-#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
-
-// Commands for cluster: Content Launch
-#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
-#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
-
 // Commands for cluster: Sample Mfg Specific Cluster
 #define ZCL_COMMAND_ONE_COMMAND_ID (0x00)
 
index 3643539..5353823 100644 (file)
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 130
+#define GENERATED_ATTRIBUTE_COUNT 127
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
         { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* Identify (server): cluster revision */                       \
             { 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },                 /* Application Basic (server): vendor id */   \
             { 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0,                                                                               \
               ZAP_LONG_DEFAULTS_INDEX(554) },                               /* Application Basic (server): application name */     \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */     \
             { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },        /* Application Basic (server): product id */           \
+            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */     \
             { 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0,                                                                               \
               ZAP_LONG_DEFAULTS_INDEX(586) },                                  /* Application Basic (server): application id */    \
             { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },           /* Application Basic (server): catalog vendor id */ \
             { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) },       /* Application Basic (server): application satus */ \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) },    /* Binding (server): cluster revision */            \
-            { 0x0000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },           /* Media Playback (server): current state */        \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) },    /* Media Playback (server): cluster revision */     \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) },    /* Content Launch (server): cluster revision */     \
             { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(618) }, /* Group Key Management (server): groups */         \
             { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(872) }, /* Group Key Management (server): group keys */     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (server): cluster revision */  \
     };
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 21
+#define GENERATED_CLUSTER_COUNT 19
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         { 0x0003,                                                                                                                  \
                 0xF000, ZAP_ATTRIBUTE_INDEX(109), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
             }, /* Endpoint: 1, Cluster: Binding (server) */                                                                        \
             {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(110), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
-            }, /* Endpoint: 1, Cluster: Media Playback (server) */                                                                 \
-            {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(112), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
-            }, /* Endpoint: 1, Cluster: Content Launch (server) */                                                                 \
-            {                                                                                                                      \
-                0xF004, ZAP_ATTRIBUTE_INDEX(113), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
+                0xF004, ZAP_ATTRIBUTE_INDEX(110), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
             }, /* Endpoint: 1, Cluster: Group Key Management (server) */                                                           \
             { 0x0006,                                                                                                              \
-              ZAP_ATTRIBUTE_INDEX(116),                                                                                            \
+              ZAP_ATTRIBUTE_INDEX(113),                                                                                            \
               2,                                                                                                                   \
               3,                                                                                                                   \
               ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION),                                                          \
               chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */                                              \
             {                                                                                                                      \
-                0x0028, ZAP_ATTRIBUTE_INDEX(118), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                          \
+                0x0028, ZAP_ATTRIBUTE_INDEX(115), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL                                          \
             }, /* Endpoint: 2, Cluster: Basic (server) */                                                                          \
     }
 
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 19, 1292 }, { ZAP_CLUSTER_INDEX(19), 2, 257 },                                                     \
+        { ZAP_CLUSTER_INDEX(0), 17, 1286 }, { ZAP_CLUSTER_INDEX(17), 2, 257 },                                                     \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_SINGLETONS_SIZE (508)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (1549)
+#define ATTRIBUTE_MAX_SIZE (1543)
 
 // Number of fixed endpoints
 #define FIXED_ENDPOINT_COUNT (2)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (132)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (117)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (server): Identify */                                 \
             { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Low Power (server): Sleep */                                   \
             { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (server): Bind */                                      \
             { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (server): Unbind */                                    \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PlayRequest */                        \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Media Playback (server): Playback */                           \
-            { 0xF001, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PauseRequest */                       \
-            { 0xF001, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): StopRequest */                        \
-            { 0xF001, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): StartOverRequest */                   \
-            { 0xF001, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PreviousRequest */                    \
-            { 0xF001, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): NextRequest */                        \
-            { 0xF001, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): RewindRequest */                      \
-            { 0xF001, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): FastForwardRequest */                 \
-            { 0xF001, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): SkipForwardRequest */                 \
-            { 0xF001, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): SkipBackwardRequest */                \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (server): LaunchContent */                      \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (server): LaunchContentResponse */              \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (server): LaunchURL */                          \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (server): LaunchURLResponse */                  \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index 07d22bb..4b14a4f 100644 (file)
@@ -34,7 +34,6 @@
 #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (2)
 #define EMBER_AF_BINDING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
-#define EMBER_AF_CONTENT_LAUNCH_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1)
@@ -43,7 +42,6 @@
 #define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT (1)
-#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (2)
 #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV
 
-// Use this macro to check if the server side of the Content Launch cluster is included
-#define ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH_SERVER
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH
-
 // Use this macro to check if the server side of the Door Lock cluster is included
 #define ZCL_USING_DOOR_LOCK_CLUSTER_SERVER
 #define EMBER_AF_PLUGIN_DOOR_LOCK_SERVER
 #define EMBER_AF_PLUGIN_LOW_POWER_SERVER
 #define EMBER_AF_PLUGIN_LOW_POWER
 
-// Use this macro to check if the server side of the Media Playback cluster is included
-#define ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK_SERVER
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK
-
 // Use this macro to check if the server side of the Network Commissioning cluster is included
 #define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER
 #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER
index e3207b7..5cb5a91 100644 (file)
 #define CHIP_PRINTCLUSTER_IAS_WD_CLUSTER
 #endif
 
+#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 1286, "Media Playback" },
+#else
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
+#endif
+
 #if defined(ZCL_USING_LOW_POWER_CLUSTER_SERVER) || defined(ZCL_USING_LOW_POWER_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER { ZCL_LOW_POWER_CLUSTER_ID, 1288, "Low Power" },
 #else
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER
 #endif
 
+#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 1290, "Content Launch" },
+#else
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
+#endif
+
 #if defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER { ZCL_APPLICATION_BASIC_CLUSTER_ID, 1293, "Application Basic" },
 #else
 #define CHIP_PRINTCLUSTER_BINDING_CLUSTER
 #endif
 
-#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 61441, "Media Playback" },
-#else
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
-#endif
-
-#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 61442, "Content Launch" },
-#else
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
-#endif
-
 #if defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER) || defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER { ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID, 61444, "Group Key Management" },
 #else
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
     CHIP_PRINTCLUSTER_DIAGNOSTICS_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_ZLL_COMMISSIONING_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_BINDING_CLUSTER                                                                                              \
-    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
-    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER                                                                                 \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER                                                                                  \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER_2                                                                                \
index c1ae2e7..f1e501c 100644 (file)
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 
-#
-# This is a project Makefile. It is assumed the directory this Makefile resides in is a
-# project subdirectory.
-#
-
 # The following lines of boilerplate have to be in your project's
 # CMakeLists in this exact order for cmake to work correctly
 cmake_minimum_required(VERSION 3.5)
@@ -33,3 +28,5 @@ set(EXTRA_COMPONENT_DIRS
 )
 
 project(chip-all-clusters-app)
+idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
+idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
index 3880074..cc5f3f1 100644 (file)
@@ -53,17 +53,32 @@ step. To install these components manually, follow these steps:
 Currently building in VSCode _and_ deploying from native is not supported, so
 make sure the IDF_PATH has been exported(See the manual setup steps above).
 
--   In the root of the example directory, sync the CHIP tree's submodules and
-    source `idf.sh`. Note: This does not have to be repeated for incremental
-    builds.
+-   Setting up the environment
 
-          $ source idf.sh
+To download and install packages.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/bootstrap.sh
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
+
+If packages are already installed then simply activate it.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
 
 -   Configuration Options
 
         To choose from the different configuration options, run menuconfig
 
-          $ idf make menuconfig
+          $ idf.py menuconfig
 
         Select ESP32 based `Device Type` through `Demo`->`Device Type`.
         The device types that are currently supported include `ESP32-DevKitC` (default),
@@ -77,13 +92,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
         `Component config`->`CHIP Device Layer`->`WiFi Station Options`->`Default WiFi SSID` and
         `Default WiFi Password` respectively.
 
-        To use the default configuration options, run the default config
+-   To build the demo application.
 
-          $ idf make defconfig
-
--   Run make to build the demo application.
-
-          $ idf make
+          $ idf.py build
 
 -   After building the application, to flash it outside of VSCode, connect your
     device via USB. Then run the following command to flash the demo application
@@ -94,7 +105,7 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
     before flashing. For ESP32-DevKitC devices this is labeled in the
     [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
 
-          $ idf make flash monitor ESPPORT=/dev/tty.SLAB_USBtoUART
+          $ idf.py flash monitor ESPPORT=/dev/tty.SLAB_USBtoUART
 
     Note: Some users might have to install the
     [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
@@ -107,7 +118,7 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
 
 -   If desired, the monitor can be run again like so:
 
-          $ idf make monitor ESPPORT=/dev/tty.SLAB_USBtoUART
+          $ idf.py monitor ESPPORT=/dev/tty.SLAB_USBtoUART
 
 ## Using the Echo Server
 
index 8c2053d..1ce17f2 100644 (file)
@@ -14,9 +14,7 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #
-#    Description:
-#      Component makefile for the ESP32 demo application.
-#
+
 # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
 # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk
 idf_component_register(PRIV_INCLUDE_DIRS 
@@ -37,9 +35,11 @@ idf_component_register(PRIV_INCLUDE_DIRS
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/barrier-control-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/color-control-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/content-launch-server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-measurement-server"
                       "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes"
index 200cb42..9c42e49 100644 (file)
@@ -37,3 +37,7 @@ CONFIG_LWIP_IPV6_AUTOCONFIG=y
 # Use a custom partition table
 CONFIG_PARTITION_TABLE_CUSTOM=y
 CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
+
+# Vendor and product id
+CONFIG_DEVICE_VENDOR_ID=0x235A
+CONFIG_DEVICE_PRODUCT_ID=0x4541
index 74c8c4a..1bfb314 100644 (file)
@@ -136,7 +136,7 @@ and the `parse-setup-payload` command
 
 #### QR Code with optional Vendor Info
 
-    $ chip-tool chip-tool payload parse-setup-payload "CH:#####"
+    $ chip-tool payload parse-setup-payload "CH:#####"
 
 #### Manual Setup Code
 
index 4f407a3..496166d 100644 (file)
@@ -103,22 +103,6 @@ static void OnStringAttributeResponse(void * context, const chip::ByteSpan value
     command->SetCommandExitStatus(true);
 }
 
-static void OnContentLaunchClusterLaunchContentResponse(void * context, uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(chipTool, "ContentLaunchClusterLaunchContentResponse");
-
-    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
-    command->SetCommandExitStatus(true);
-}
-
-static void OnContentLaunchClusterLaunchURLResponse(void * context, uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(chipTool, "ContentLaunchClusterLaunchURLResponse");
-
-    ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
-    command->SetCommandExitStatus(true);
-}
-
 static void OnDoorLockClusterClearAllPinsResponse(void * context)
 {
     ChipLogProgress(chipTool, "DoorLockClusterClearAllPinsResponse");
@@ -431,14 +415,12 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u
 | Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
-| ContentLaunch                                                       | 0xF002 |
 | DoorLock                                                            | 0x0101 |
 | GeneralCommissioning                                                | 0x0030 |
 | Groups                                                              | 0x0004 |
 | Identify                                                            | 0x0003 |
 | LevelControl                                                        | 0x0008 |
 | LowPower                                                            | 0x0508 |
-| MediaPlayback                                                       | 0xF001 |
 | OnOff                                                               | 0x0006 |
 | Scenes                                                              | 0x0005 |
 | TemperatureMeasurement                                              | 0x0402 |
@@ -449,14 +431,12 @@ constexpr chip::ClusterId kBarrierControlClusterId         = 0x0103;
 constexpr chip::ClusterId kBasicClusterId                  = 0x0028;
 constexpr chip::ClusterId kBindingClusterId                = 0xF000;
 constexpr chip::ClusterId kColorControlClusterId           = 0x0300;
-constexpr chip::ClusterId kContentLaunchClusterId          = 0xF002;
 constexpr chip::ClusterId kDoorLockClusterId               = 0x0101;
 constexpr chip::ClusterId kGeneralCommissioningClusterId   = 0x0030;
 constexpr chip::ClusterId kGroupsClusterId                 = 0x0004;
 constexpr chip::ClusterId kIdentifyClusterId               = 0x0003;
 constexpr chip::ClusterId kLevelControlClusterId           = 0x0008;
 constexpr chip::ClusterId kLowPowerClusterId               = 0x0508;
-constexpr chip::ClusterId kMediaPlaybackClusterId          = 0xF001;
 constexpr chip::ClusterId kOnOffClusterId                  = 0x0006;
 constexpr chip::ClusterId kScenesClusterId                 = 0x0005;
 constexpr chip::ClusterId kTemperatureMeasurementClusterId = 0x0402;
@@ -485,6 +465,12 @@ class DiscoverApplicationBasicAttributes : public ModelCommand
 public:
     DiscoverApplicationBasicAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverApplicationBasicAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -513,6 +499,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicVendorName()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -541,6 +533,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicVendorId()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -569,6 +567,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicApplicationName()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -597,6 +601,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicProductId()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -625,6 +635,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicApplicationId()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -653,6 +669,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicCatalogVendorId()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -681,6 +703,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicApplicationSatus()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -709,6 +737,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadApplicationBasicClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x050D) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -751,6 +785,11 @@ public:
         AddArgument("percentOpen", 0, UINT8_MAX, &mPercentOpen);
         ModelCommand::AddArguments();
     }
+    ~BarrierControlBarrierControlGoToPercent()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -776,6 +815,11 @@ class BarrierControlBarrierControlStop : public ModelCommand
 {
 public:
     BarrierControlBarrierControlStop() : ModelCommand("barrier-control-stop") { ModelCommand::AddArguments(); }
+    ~BarrierControlBarrierControlStop()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -801,6 +845,12 @@ class DiscoverBarrierControlAttributes : public ModelCommand
 public:
     DiscoverBarrierControlAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverBarrierControlAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -829,6 +879,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBarrierControlBarrierMovingState()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0103) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -857,6 +913,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBarrierControlBarrierSafetyStatus()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0103) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -885,6 +947,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBarrierControlBarrierCapabilities()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0103) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -913,6 +981,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBarrierControlBarrierPosition()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0103) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -941,6 +1015,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBarrierControlClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0103) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -985,6 +1065,11 @@ class BasicMfgSpecificPing : public ModelCommand
 {
 public:
     BasicMfgSpecificPing() : ModelCommand("mfg-specific-ping") { ModelCommand::AddArguments(); }
+    ~BasicMfgSpecificPing()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1010,6 +1095,12 @@ class DiscoverBasicAttributes : public ModelCommand
 public:
     DiscoverBasicAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverBasicAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -1038,6 +1129,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicInteractionModelVersion()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1066,6 +1163,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicVendorName()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1094,6 +1197,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicVendorID()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1122,6 +1231,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicProductName()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1150,6 +1265,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicProductID()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1178,6 +1299,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicUserLabel()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1204,6 +1331,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteBasicUserLabel()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -1234,6 +1367,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicLocation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1260,6 +1399,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteBasicLocation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -1290,6 +1435,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicHardwareVersion()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1318,6 +1469,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicHardwareVersionString()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1346,6 +1503,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicSoftwareVersion()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1374,6 +1537,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicSoftwareVersionString()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1402,6 +1571,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBasicClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0028) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1443,6 +1618,11 @@ public:
         AddArgument("clusterId", 0, UINT16_MAX, &mClusterId);
         ModelCommand::AddArguments();
     }
+    ~BindingBind()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1478,6 +1658,11 @@ public:
         AddArgument("clusterId", 0, UINT16_MAX, &mClusterId);
         ModelCommand::AddArguments();
     }
+    ~BindingUnbind()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1507,6 +1692,12 @@ class DiscoverBindingAttributes : public ModelCommand
 public:
     DiscoverBindingAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverBindingAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -1535,6 +1726,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadBindingClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0xF000) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -1638,6 +1835,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveColor()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1676,6 +1878,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveColorTemperature()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1714,6 +1921,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1750,6 +1962,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1787,6 +2004,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveToColor()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1824,6 +2046,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveToColorTemperature()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1861,6 +2088,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveToHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1899,6 +2131,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveToHueAndSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1936,6 +2173,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlMoveToSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -1973,6 +2215,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlStepColor()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -2013,6 +2260,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlStepColorTemperature()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -2054,6 +2306,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlStepHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -2092,6 +2349,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlStepSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -2127,6 +2389,11 @@ public:
         AddArgument("optionsOverride", 0, UINT8_MAX, &mOptionsOverride);
         ModelCommand::AddArguments();
     }
+    ~ColorControlStopMoveStep()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -2154,6 +2421,12 @@ class DiscoverColorControlAttributes : public ModelCommand
 public:
     DiscoverColorControlAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverColorControlAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -2182,6 +2455,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCurrentHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2210,6 +2489,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportColorControlCurrentHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -2251,6 +2537,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCurrentSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2279,6 +2571,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportColorControlCurrentSaturation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -2320,6 +2619,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlRemainingTime()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2348,6 +2653,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCurrentX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2376,6 +2687,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportColorControlCurrentX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -2417,6 +2735,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCurrentY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2445,6 +2769,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportColorControlCurrentY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -2486,6 +2817,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlDriftCompensation()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2514,6 +2851,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCompensationText()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2542,6 +2885,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorTemperature()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2570,6 +2919,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportColorControlColorTemperature()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -2611,6 +2967,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorMode()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2639,6 +3001,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorControlOptions()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2665,6 +3033,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorControlOptions()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -2694,6 +3068,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlNumberOfPrimaries()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2722,6 +3102,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary1X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2750,6 +3136,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary1Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2778,6 +3170,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary1Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2806,6 +3204,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary2X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2834,6 +3238,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary2Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2862,6 +3272,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary2Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2890,6 +3306,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary3X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2918,6 +3340,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary3Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2946,6 +3374,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary3Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -2974,6 +3408,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary4X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3002,6 +3442,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary4Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3030,6 +3476,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary4Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3058,6 +3510,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary5X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3086,6 +3544,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary5Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3114,6 +3578,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary5Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3142,6 +3612,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary6X()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3170,6 +3646,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary6Y()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3198,6 +3680,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlPrimary6Intensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3226,9 +3714,15 @@ public:
         ModelCommand::AddArguments();
     }
 
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    ~ReadColorControlWhitePointX()
     {
-        ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
+    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    {
+        ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
 
         chip::Controller::ColorControlCluster cluster;
         cluster.Associate(device, endpointId);
@@ -3252,6 +3746,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlWhitePointX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3281,6 +3781,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlWhitePointY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3307,6 +3813,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlWhitePointY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3336,6 +3848,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointRX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3362,6 +3880,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointRX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3391,6 +3915,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointRY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3417,6 +3947,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointRY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3446,6 +3982,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointRIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3472,6 +4014,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointRIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3501,6 +4049,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointGX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3527,6 +4081,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointGX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3556,6 +4116,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointGY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3582,6 +4148,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointGY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3611,6 +4183,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointGIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3637,6 +4215,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointGIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3666,6 +4250,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointBX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3692,6 +4282,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointBX()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3721,6 +4317,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointBY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3747,6 +4349,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointBY()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3776,6 +4384,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorPointBIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3802,6 +4416,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlColorPointBIntensity()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -3831,6 +4451,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlEnhancedCurrentHue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3859,6 +4485,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlEnhancedColorMode()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3887,6 +4519,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorLoopActive()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3915,6 +4553,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorLoopDirection()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3943,6 +4587,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorLoopTime()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3971,6 +4621,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorCapabilities()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -3999,6 +4655,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorTempPhysicalMin()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -4027,6 +4689,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlColorTempPhysicalMax()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -4055,6 +4723,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlCoupleColorTempToLevelMinMireds()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -4083,6 +4757,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadColorControlStartUpColorTemperatureMireds()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -4109,6 +4789,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteColorControlStartUpColorTemperatureMireds()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -4139,123 +4825,17 @@ public:
         ModelCommand::AddArguments();
     }
 
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::ColorControlCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<Int16uAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<Int16uAttributeCallback>(OnInt16uAttributeResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*----------------------------------------------------------------------------*\
-| Cluster ContentLaunch                                               | 0xF002 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * LaunchContent                                                     |   0x00 |
-| * LaunchURL                                                         |   0x01 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/*
- * Command LaunchContent
- */
-class ContentLaunchLaunchContent : public ModelCommand
-{
-public:
-    ContentLaunchLaunchContent() : ModelCommand("launch-content") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF002) command (0x00) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::ContentLaunchCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.LaunchContent(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback> * onSuccessCallback =
-        new chip::Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback>(OnContentLaunchClusterLaunchContentResponse,
-                                                                                        this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command LaunchURL
- */
-class ContentLaunchLaunchURL : public ModelCommand
-{
-public:
-    ContentLaunchLaunchURL() : ModelCommand("launch-url") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF002) command (0x01) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::ContentLaunchCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.LaunchURL(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback> * onSuccessCallback =
-        new chip::Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback>(OnContentLaunchClusterLaunchURLResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Discover Attributes
- */
-class DiscoverContentLaunchAttributes : public ModelCommand
-{
-public:
-    DiscoverContentLaunchAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::ContentLaunchCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Attribute ClusterRevision
- */
-class ReadContentLaunchClusterRevision : public ModelCommand
-{
-public:
-    ReadContentLaunchClusterRevision() : ModelCommand("read")
+    ~ReadColorControlClusterRevision()
     {
-        AddArgument("attr-name", "cluster-revision");
-        ModelCommand::AddArguments();
+        delete onSuccessCallback;
+        delete onFailureCallback;
     }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0xF002) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0300) command (0x00) on endpoint %" PRIu16, endpointId);
 
-        chip::Controller::ContentLaunchCluster cluster;
+        chip::Controller::ColorControlCluster cluster;
         cluster.Associate(device, endpointId);
         return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
     }
@@ -4309,6 +4889,11 @@ class DoorLockClearAllPins : public ModelCommand
 {
 public:
     DoorLockClearAllPins() : ModelCommand("clear-all-pins") { ModelCommand::AddArguments(); }
+    ~DoorLockClearAllPins()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4333,6 +4918,11 @@ class DoorLockClearAllRfids : public ModelCommand
 {
 public:
     DoorLockClearAllRfids() : ModelCommand("clear-all-rfids") { ModelCommand::AddArguments(); }
+    ~DoorLockClearAllRfids()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4361,6 +4951,11 @@ public:
         AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockClearHolidaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4391,6 +4986,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockClearPin()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4420,6 +5020,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockClearRfid()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4450,6 +5055,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockClearWeekdaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4482,6 +5092,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockClearYeardaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4513,6 +5128,11 @@ public:
         AddArgument("scheduleId", 0, UINT8_MAX, &mScheduleId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetHolidaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4543,6 +5163,11 @@ public:
         AddArgument("logIndex", 0, UINT16_MAX, &mLogIndex);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetLogRecord()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4572,6 +5197,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetPin()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4601,6 +5231,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetRfid()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4630,6 +5265,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetUserType()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4660,6 +5300,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetWeekdaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4692,6 +5337,11 @@ public:
         AddArgument("userId", 0, UINT16_MAX, &mUserId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockGetYeardaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4723,6 +5373,11 @@ public:
         AddArgument("pin", &mPin);
         ModelCommand::AddArguments();
     }
+    ~DoorLockLockDoor()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4756,6 +5411,11 @@ public:
         AddArgument("operatingModeDuringHoliday", 0, UINT8_MAX, &mOperatingModeDuringHoliday);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetHolidaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4793,6 +5453,11 @@ public:
         AddArgument("pin", &mPin);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetPin()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4829,6 +5494,11 @@ public:
         AddArgument("id", &mId);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetRfid()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4863,6 +5533,11 @@ public:
         AddArgument("userType", 0, UINT8_MAX, &mUserType);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetUserType()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4899,6 +5574,11 @@ public:
         AddArgument("endMinute", 0, UINT8_MAX, &mEndMinute);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetWeekdaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4939,6 +5619,11 @@ public:
         AddArgument("localEndTime", 0, UINT32_MAX, &mLocalEndTime);
         ModelCommand::AddArguments();
     }
+    ~DoorLockSetYeardaySchedule()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -4973,6 +5658,11 @@ public:
         AddArgument("pin", &mPin);
         ModelCommand::AddArguments();
     }
+    ~DoorLockUnlockDoor()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5004,6 +5694,11 @@ public:
         AddArgument("pin", &mPin);
         ModelCommand::AddArguments();
     }
+    ~DoorLockUnlockWithTimeout()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5033,6 +5728,12 @@ class DiscoverDoorLockAttributes : public ModelCommand
 public:
     DiscoverDoorLockAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverDoorLockAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -5061,6 +5762,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadDoorLockLockState()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5088,6 +5795,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportDoorLockLockState()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -5128,6 +5842,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadDoorLockLockType()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5156,6 +5876,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadDoorLockActuatorEnabled()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5184,6 +5910,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadDoorLockClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5227,6 +5959,11 @@ public:
         AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs);
         ModelCommand::AddArguments();
     }
+    ~GeneralCommissioningArmFailSafe()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5256,6 +5993,11 @@ class GeneralCommissioningCommissioningComplete : public ModelCommand
 {
 public:
     GeneralCommissioningCommissioningComplete() : ModelCommand("commissioning-complete") { ModelCommand::AddArguments(); }
+    ~GeneralCommissioningCommissioningComplete()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5288,6 +6030,11 @@ public:
         AddArgument("timeoutMs", 0, UINT32_MAX, &mTimeoutMs);
         ModelCommand::AddArguments();
     }
+    ~GeneralCommissioningSetFabric()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5321,6 +6068,12 @@ class DiscoverGeneralCommissioningAttributes : public ModelCommand
 public:
     DiscoverGeneralCommissioningAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverGeneralCommissioningAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -5349,6 +6102,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadGeneralCommissioningFabricId()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0030) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5377,6 +6136,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadGeneralCommissioningBreadcrumb()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0030) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5403,6 +6168,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteGeneralCommissioningBreadcrumb()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0030) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -5432,6 +6203,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadGeneralCommissioningClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0030) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5476,6 +6253,11 @@ public:
         AddArgument("groupName", &mGroupName);
         ModelCommand::AddArguments();
     }
+    ~GroupsAddGroup()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5508,6 +6290,11 @@ public:
         AddArgument("groupName", &mGroupName);
         ModelCommand::AddArguments();
     }
+    ~GroupsAddGroupIfIdentifying()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5540,6 +6327,11 @@ public:
         AddArgument("groupList", 0, UINT16_MAX, &mGroupList);
         ModelCommand::AddArguments();
     }
+    ~GroupsGetGroupMembership()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5567,6 +6359,11 @@ class GroupsRemoveAllGroups : public ModelCommand
 {
 public:
     GroupsRemoveAllGroups() : ModelCommand("remove-all-groups") { ModelCommand::AddArguments(); }
+    ~GroupsRemoveAllGroups()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5595,6 +6392,11 @@ public:
         AddArgument("groupId", 0, UINT16_MAX, &mGroupId);
         ModelCommand::AddArguments();
     }
+    ~GroupsRemoveGroup()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5624,6 +6426,11 @@ public:
         AddArgument("groupId", 0, UINT16_MAX, &mGroupId);
         ModelCommand::AddArguments();
     }
+    ~GroupsViewGroup()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5650,6 +6457,12 @@ class DiscoverGroupsAttributes : public ModelCommand
 public:
     DiscoverGroupsAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverGroupsAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -5678,6 +6491,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadGroupsNameSupport()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5706,6 +6525,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadGroupsClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0004) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5745,6 +6570,11 @@ public:
         AddArgument("identifyTime", 0, UINT16_MAX, &mIdentifyTime);
         ModelCommand::AddArguments();
     }
+    ~IdentifyIdentify()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5770,6 +6600,11 @@ class IdentifyIdentifyQuery : public ModelCommand
 {
 public:
     IdentifyIdentifyQuery() : ModelCommand("identify-query") { ModelCommand::AddArguments(); }
+    ~IdentifyIdentifyQuery()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5795,6 +6630,12 @@ class DiscoverIdentifyAttributes : public ModelCommand
 public:
     DiscoverIdentifyAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverIdentifyAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -5823,6 +6664,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadIdentifyIdentifyTime()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0003) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5849,6 +6696,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~WriteIdentifyIdentifyTime()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0003) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -5878,6 +6731,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadIdentifyClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0003) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -5926,6 +6785,11 @@ public:
         AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride);
         ModelCommand::AddArguments();
     }
+    ~LevelControlMove()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5962,6 +6826,11 @@ public:
         AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride);
         ModelCommand::AddArguments();
     }
+    ~LevelControlMoveToLevel()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -5996,6 +6865,11 @@ public:
         AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime);
         ModelCommand::AddArguments();
     }
+    ~LevelControlMoveToLevelWithOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6027,6 +6901,11 @@ public:
         AddArgument("rate", 0, UINT8_MAX, &mRate);
         ModelCommand::AddArguments();
     }
+    ~LevelControlMoveWithOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6061,6 +6940,11 @@ public:
         AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride);
         ModelCommand::AddArguments();
     }
+    ~LevelControlStep()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6097,6 +6981,11 @@ public:
         AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime);
         ModelCommand::AddArguments();
     }
+    ~LevelControlStepWithOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6130,6 +7019,11 @@ public:
         AddArgument("optionOverride", 0, UINT8_MAX, &mOptionOverride);
         ModelCommand::AddArguments();
     }
+    ~LevelControlStop()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6156,6 +7050,11 @@ class LevelControlStopWithOnOff : public ModelCommand
 {
 public:
     LevelControlStopWithOnOff() : ModelCommand("stop-with-on-off") { ModelCommand::AddArguments(); }
+    ~LevelControlStopWithOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6181,6 +7080,12 @@ class DiscoverLevelControlAttributes : public ModelCommand
 public:
     DiscoverLevelControlAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverLevelControlAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -6209,6 +7114,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadLevelControlCurrentLevel()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -6237,6 +7148,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportLevelControlCurrentLevel()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -6278,6 +7196,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadLevelControlClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0008) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -6311,6 +7235,11 @@ class LowPowerSleep : public ModelCommand
 {
 public:
     LowPowerSleep() : ModelCommand("sleep") { ModelCommand::AddArguments(); }
+    ~LowPowerSleep()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6336,6 +7265,12 @@ class DiscoverLowPowerAttributes : public ModelCommand
 public:
     DiscoverLowPowerAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverLowPowerAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -6364,351 +7299,17 @@ public:
         ModelCommand::AddArguments();
     }
 
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::LowPowerCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<Int16uAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<Int16uAttributeCallback>(OnInt16uAttributeResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*----------------------------------------------------------------------------*\
-| Cluster MediaPlayback                                               | 0xF001 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * FastForwardRequest                                                |   0x07 |
-| * NextRequest                                                       |   0x05 |
-| * PauseRequest                                                      |   0x01 |
-| * PlayRequest                                                       |   0x00 |
-| * PreviousRequest                                                   |   0x04 |
-| * RewindRequest                                                     |   0x06 |
-| * SkipBackwardRequest                                               |   0x09 |
-| * SkipForwardRequest                                                |   0x08 |
-| * StartOverRequest                                                  |   0x03 |
-| * StopRequest                                                       |   0x02 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * CurrentState                                                      | 0x0000 |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/*
- * Command FastForwardRequest
- */
-class MediaPlaybackFastForwardRequest : public ModelCommand
-{
-public:
-    MediaPlaybackFastForwardRequest() : ModelCommand("fast-forward-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x07) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.FastForwardRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command NextRequest
- */
-class MediaPlaybackNextRequest : public ModelCommand
-{
-public:
-    MediaPlaybackNextRequest() : ModelCommand("next-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
+    ~ReadLowPowerClusterRevision()
     {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x05) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.NextRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
+        delete onSuccessCallback;
+        delete onFailureCallback;
     }
 
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command PauseRequest
- */
-class MediaPlaybackPauseRequest : public ModelCommand
-{
-public:
-    MediaPlaybackPauseRequest() : ModelCommand("pause-request") { ModelCommand::AddArguments(); }
-
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x01) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.PauseRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command PlayRequest
- */
-class MediaPlaybackPlayRequest : public ModelCommand
-{
-public:
-    MediaPlaybackPlayRequest() : ModelCommand("play-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x00) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.PlayRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command PreviousRequest
- */
-class MediaPlaybackPreviousRequest : public ModelCommand
-{
-public:
-    MediaPlaybackPreviousRequest() : ModelCommand("previous-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x04) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.PreviousRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command RewindRequest
- */
-class MediaPlaybackRewindRequest : public ModelCommand
-{
-public:
-    MediaPlaybackRewindRequest() : ModelCommand("rewind-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x06) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.RewindRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command SkipBackwardRequest
- */
-class MediaPlaybackSkipBackwardRequest : public ModelCommand
-{
-public:
-    MediaPlaybackSkipBackwardRequest() : ModelCommand("skip-backward-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x09) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.SkipBackwardRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command SkipForwardRequest
- */
-class MediaPlaybackSkipForwardRequest : public ModelCommand
-{
-public:
-    MediaPlaybackSkipForwardRequest() : ModelCommand("skip-forward-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x08) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.SkipForwardRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command StartOverRequest
- */
-class MediaPlaybackStartOverRequest : public ModelCommand
-{
-public:
-    MediaPlaybackStartOverRequest() : ModelCommand("start-over-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x03) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.StartOverRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Command StopRequest
- */
-class MediaPlaybackStopRequest : public ModelCommand
-{
-public:
-    MediaPlaybackStopRequest() : ModelCommand("stop-request") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x02) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.StopRequest(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Discover Attributes
- */
-class DiscoverMediaPlaybackAttributes : public ModelCommand
-{
-public:
-    DiscoverMediaPlaybackAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.DiscoverAttributes(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<DefaultSuccessCallback> * onSuccessCallback =
-        new chip::Callback::Callback<DefaultSuccessCallback>(OnDefaultSuccessResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Attribute CurrentState
- */
-class ReadMediaPlaybackCurrentState : public ModelCommand
-{
-public:
-    ReadMediaPlaybackCurrentState() : ModelCommand("read")
-    {
-        AddArgument("attr-name", "current-state");
-        ModelCommand::AddArguments();
-    }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x00) on endpoint %" PRIu16, endpointId);
-
-        chip::Controller::MediaPlaybackCluster cluster;
-        cluster.Associate(device, endpointId);
-        return cluster.ReadAttributeCurrentState(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
-    }
-
-private:
-    chip::Callback::Callback<Int16uAttributeCallback> * onSuccessCallback =
-        new chip::Callback::Callback<Int16uAttributeCallback>(OnInt16uAttributeResponse, this);
-    chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
-        new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
-};
-
-/*
- * Attribute ClusterRevision
- */
-class ReadMediaPlaybackClusterRevision : public ModelCommand
-{
-public:
-    ReadMediaPlaybackClusterRevision() : ModelCommand("read")
-    {
-        AddArgument("attr-name", "cluster-revision");
-        ModelCommand::AddArguments();
-    }
-
-    CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
-    {
-        ChipLogProgress(chipTool, "Sending cluster (0xF001) command (0x00) on endpoint %" PRIu16, endpointId);
+        ChipLogProgress(chipTool, "Sending cluster (0x0508) command (0x00) on endpoint %" PRIu16, endpointId);
 
-        chip::Controller::MediaPlaybackCluster cluster;
+        chip::Controller::LowPowerCluster cluster;
         cluster.Associate(device, endpointId);
         return cluster.ReadAttributeClusterRevision(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
     }
@@ -6740,6 +7341,11 @@ class OnOffOff : public ModelCommand
 {
 public:
     OnOffOff() : ModelCommand("off") { ModelCommand::AddArguments(); }
+    ~OnOffOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6764,6 +7370,11 @@ class OnOffOn : public ModelCommand
 {
 public:
     OnOffOn() : ModelCommand("on") { ModelCommand::AddArguments(); }
+    ~OnOffOn()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6788,6 +7399,11 @@ class OnOffToggle : public ModelCommand
 {
 public:
     OnOffToggle() : ModelCommand("toggle") { ModelCommand::AddArguments(); }
+    ~OnOffToggle()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6813,6 +7429,12 @@ class DiscoverOnOffAttributes : public ModelCommand
 public:
     DiscoverOnOffAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverOnOffAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -6841,6 +7463,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadOnOffOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0006) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -6868,6 +7496,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportOnOffOnOff()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0006) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -6908,6 +7543,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadOnOffClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0006) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -6962,6 +7603,11 @@ public:
         AddArgument("value", 0, UINT8_MAX, &mValue);
         ModelCommand::AddArguments();
     }
+    ~ScenesAddScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -6999,6 +7645,11 @@ public:
         AddArgument("groupId", 0, UINT16_MAX, &mGroupId);
         ModelCommand::AddArguments();
     }
+    ~ScenesGetSceneMembership()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7031,6 +7682,11 @@ public:
         AddArgument("transitionTime", 0, UINT16_MAX, &mTransitionTime);
         ModelCommand::AddArguments();
     }
+    ~ScenesRecallScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7062,6 +7718,11 @@ public:
         AddArgument("groupId", 0, UINT16_MAX, &mGroupId);
         ModelCommand::AddArguments();
     }
+    ~ScenesRemoveAllScenes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7092,6 +7753,11 @@ public:
         AddArgument("sceneId", 0, UINT8_MAX, &mSceneId);
         ModelCommand::AddArguments();
     }
+    ~ScenesRemoveScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7123,6 +7789,11 @@ public:
         AddArgument("sceneId", 0, UINT8_MAX, &mSceneId);
         ModelCommand::AddArguments();
     }
+    ~ScenesStoreScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7154,6 +7825,11 @@ public:
         AddArgument("sceneId", 0, UINT8_MAX, &mSceneId);
         ModelCommand::AddArguments();
     }
+    ~ScenesViewScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -7181,6 +7857,12 @@ class DiscoverScenesAttributes : public ModelCommand
 public:
     DiscoverScenesAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverScenesAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -7209,6 +7891,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesSceneCount()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7237,6 +7925,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesCurrentScene()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7265,6 +7959,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesCurrentGroup()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7293,6 +7993,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesSceneValid()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7321,6 +8027,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesNameSupport()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7349,6 +8061,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadScenesClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0005) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7385,6 +8103,12 @@ class DiscoverTemperatureMeasurementAttributes : public ModelCommand
 public:
     DiscoverTemperatureMeasurementAttributes() : ModelCommand("discover") { ModelCommand::AddArguments(); }
 
+    ~DiscoverTemperatureMeasurementAttributes()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0000) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -7413,6 +8137,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadTemperatureMeasurementMeasuredValue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0402) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7441,6 +8171,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReportTemperatureMeasurementMeasuredValue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+        delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0402) command (0x06) on endpoint %" PRIu16, endpointId);
@@ -7482,6 +8219,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadTemperatureMeasurementMinMeasuredValue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0402) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7510,6 +8253,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadTemperatureMeasurementMaxMeasuredValue()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0402) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7538,6 +8287,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~ReadTemperatureMeasurementClusterRevision()
+    {
+        delete onSuccessCallback;
+        delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster (0x0402) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -7715,19 +8470,6 @@ void registerClusterColorControl(Commands & commands)
 
     commands.Register(clusterName, clusterCommands);
 }
-void registerClusterContentLaunch(Commands & commands)
-{
-    const char * clusterName = "ContentLaunch";
-
-    commands_list clusterCommands = {
-        make_unique<ContentLaunchLaunchContent>(),
-        make_unique<ContentLaunchLaunchURL>(),
-        make_unique<DiscoverContentLaunchAttributes>(),
-        make_unique<ReadContentLaunchClusterRevision>(),
-    };
-
-    commands.Register(clusterName, clusterCommands);
-}
 void registerClusterDoorLock(Commands & commands)
 {
     const char * clusterName = "DoorLock";
@@ -7842,22 +8584,6 @@ void registerClusterLowPower(Commands & commands)
 
     commands.Register(clusterName, clusterCommands);
 }
-void registerClusterMediaPlayback(Commands & commands)
-{
-    const char * clusterName = "MediaPlayback";
-
-    commands_list clusterCommands = {
-        make_unique<MediaPlaybackFastForwardRequest>(),  make_unique<MediaPlaybackNextRequest>(),
-        make_unique<MediaPlaybackPauseRequest>(),        make_unique<MediaPlaybackPlayRequest>(),
-        make_unique<MediaPlaybackPreviousRequest>(),     make_unique<MediaPlaybackRewindRequest>(),
-        make_unique<MediaPlaybackSkipBackwardRequest>(), make_unique<MediaPlaybackSkipForwardRequest>(),
-        make_unique<MediaPlaybackStartOverRequest>(),    make_unique<MediaPlaybackStopRequest>(),
-        make_unique<DiscoverMediaPlaybackAttributes>(),  make_unique<ReadMediaPlaybackCurrentState>(),
-        make_unique<ReadMediaPlaybackClusterRevision>(),
-    };
-
-    commands.Register(clusterName, clusterCommands);
-}
 void registerClusterOnOff(Commands & commands)
 {
     const char * clusterName = "OnOff";
@@ -7908,14 +8634,12 @@ void registerClusters(Commands & commands)
     registerClusterBasic(commands);
     registerClusterBinding(commands);
     registerClusterColorControl(commands);
-    registerClusterContentLaunch(commands);
     registerClusterDoorLock(commands);
     registerClusterGeneralCommissioning(commands);
     registerClusterGroups(commands);
     registerClusterIdentify(commands);
     registerClusterLevelControl(commands);
     registerClusterLowPower(commands);
-    registerClusterMediaPlayback(commands);
     registerClusterOnOff(commands);
     registerClusterScenes(commands);
     registerClusterTemperatureMeasurement(commands);
index 85e97e5..d07348e 100644 (file)
@@ -28,6 +28,19 @@ class Listen : public ReportingCommand
 public:
     Listen() : ReportingCommand("listen") {}
 
+    ~Listen()
+    {
+        delete onReportColorControlCurrentHueCallback;
+        delete onReportColorControlCurrentSaturationCallback;
+        delete onReportColorControlCurrentXCallback;
+        delete onReportColorControlCurrentYCallback;
+        delete onReportColorControlColorTemperatureCallback;
+        delete onReportDoorLockLockStateCallback;
+        delete onReportLevelControlCurrentLevelCallback;
+        delete onReportOnOffOnOffCallback;
+        delete onReportTemperatureMeasurementMeasuredValueCallback;
+    }
+
     void AddReportCallbacks(uint8_t endpointId) override
     {
         chip::app::CHIPDeviceCallbacksMgr & callbacksMgr = chip::app::CHIPDeviceCallbacksMgr::GetInstance();
index 2170fd3..454c1df 100644 (file)
@@ -55,8 +55,6 @@ exit:
 
 void PersistentStorage::SetStorageDelegate(PersistentStorageResultDelegate * delegate) {}
 
-void PersistentStorage::AsyncGetKeyValue(const char * key) {}
-
 CHIP_ERROR PersistentStorage::SyncGetKeyValue(const char * key, char * value, uint16_t & size)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
index 85fc73f..066b43d 100644 (file)
@@ -29,7 +29,6 @@ public:
 
     /////////// PersistentStorageDelegate Interface /////////
     void SetStorageDelegate(chip::PersistentStorageResultDelegate * delegate) override;
-    void AsyncGetKeyValue(const char * key) override;
     CHIP_ERROR SyncGetKeyValue(const char * key, char * value, uint16_t & size) override;
     void AsyncSetKeyValue(const char * key, const char * value) override;
     void AsyncDeleteKeyValue(const char * key) override;
index 71fe6c6..2f78e0b 100644 (file)
@@ -686,32 +686,6 @@ bool emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16
     return true;
 }
 
-bool emberAfContentLaunchClusterLaunchContentResponseCallback(uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(Zcl, "LaunchContentResponse:");
-    ChipLogProgress(Zcl, "  contentLaunchStatus: %" PRIu8 "", contentLaunchStatus);
-
-    GET_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchContentResponseCallback");
-
-    Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback> * cb =
-        Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback>::FromCancelable(onSuccessCallback);
-    cb->mCall(cb->mContext, contentLaunchStatus);
-    return true;
-}
-
-bool emberAfContentLaunchClusterLaunchURLResponseCallback(uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(Zcl, "LaunchURLResponse:");
-    ChipLogProgress(Zcl, "  contentLaunchStatus: %" PRIu8 "", contentLaunchStatus);
-
-    GET_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchURLResponseCallback");
-
-    Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback> * cb =
-        Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback>::FromCancelable(onSuccessCallback);
-    cb->mCall(cb->mContext, contentLaunchStatus);
-    return true;
-}
-
 bool emberAfDoorLockClusterClearAllPinsResponseCallback(uint8_t status)
 {
     ChipLogProgress(Zcl, "ClearAllPinsResponse:");
index 00c37b8..a6adcbc 100644 (file)
@@ -39,8 +39,6 @@ typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint1
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
 // Cluster Specific Response Callbacks
-typedef void (*ContentLaunchClusterLaunchContentResponseCallback)(void * context, uint8_t contentLaunchStatus);
-typedef void (*ContentLaunchClusterLaunchURLResponseCallback)(void * context, uint8_t contentLaunchStatus);
 typedef void (*DoorLockClusterClearAllPinsResponseCallback)(void * context);
 typedef void (*DoorLockClusterClearAllRfidsResponseCallback)(void * context);
 typedef void (*DoorLockClusterClearHolidayScheduleResponseCallback)(void * context);
@@ -82,7 +80,6 @@ typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context,
 typedef void (*GroupsClusterRemoveGroupResponseCallback)(void * context, uint16_t groupId);
 typedef void (*GroupsClusterViewGroupResponseCallback)(void * context, uint16_t groupId, uint8_t * groupName);
 typedef void (*IdentifyClusterIdentifyQueryResponseCallback)(void * context, uint16_t timeout);
-typedef void (*MediaPlaybackClusterPlaybackCallback)(void * context);
 typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId);
 typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId,
                                                                 uint8_t sceneCount,
index 847dc97..93e5db9 100644 (file)
@@ -301,19 +301,6 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
- * Cluster Content Launch
- *
- */
-@interface CHIPContentLaunch : CHIPCluster
-
-- (void)launchContent:(ResponseHandler)completionHandler;
-- (void)launchURL:(ResponseHandler)completionHandler;
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
-
-@end
-
-/**
  * Cluster Door Lock
  *
  */
@@ -492,28 +479,6 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
- * Cluster Media Playback
- *
- */
-@interface CHIPMediaPlayback : CHIPCluster
-
-- (void)fastForwardRequest:(ResponseHandler)completionHandler;
-- (void)nextRequest:(ResponseHandler)completionHandler;
-- (void)pauseRequest:(ResponseHandler)completionHandler;
-- (void)playRequest:(ResponseHandler)completionHandler;
-- (void)previousRequest:(ResponseHandler)completionHandler;
-- (void)rewindRequest:(ResponseHandler)completionHandler;
-- (void)skipBackwardRequest:(ResponseHandler)completionHandler;
-- (void)skipForwardRequest:(ResponseHandler)completionHandler;
-- (void)startOverRequest:(ResponseHandler)completionHandler;
-- (void)stopRequest:(ResponseHandler)completionHandler;
-
-- (void)readAttributeCurrentState:(ResponseHandler)completionHandler;
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
-
-@end
-
-/**
  * Cluster On/off
  *
  */
index f256509..3a8c26e 100644 (file)
@@ -74,9 +74,7 @@ public:
         CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:status
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"" }];
+                NSError * error = [CHIPError errorForCHIPErrorCode:status];
                 callback->mHandler(error, nil);
                 callback->Cancel();
                 delete callback;
@@ -356,70 +354,6 @@ private:
     bool mKeepAlive;
 };
 
-class CHIPContentLaunchClusterLaunchContentResponseCallbackBridge
-    : public Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback> {
-public:
-    CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPContentLaunchClusterLaunchContentResponseCallbackBridge() {};
-
-    static void CallbackFn(void * context, uint8_t contentLaunchStatus)
-    {
-        CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * callback
-            = reinterpret_cast<CHIPContentLaunchClusterLaunchContentResponseCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {
-                    @"contentLaunchStatus" : [NSNumber numberWithUnsignedChar:contentLaunchStatus],
-                });
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
-class CHIPContentLaunchClusterLaunchURLResponseCallbackBridge
-    : public Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback> {
-public:
-    CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPContentLaunchClusterLaunchURLResponseCallbackBridge() {};
-
-    static void CallbackFn(void * context, uint8_t contentLaunchStatus)
-    {
-        CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * callback
-            = reinterpret_cast<CHIPContentLaunchClusterLaunchURLResponseCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {
-                    @"contentLaunchStatus" : [NSNumber numberWithUnsignedChar:contentLaunchStatus],
-                });
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
 class CHIPDoorLockClusterClearAllPinsResponseCallbackBridge
     : public Callback::Callback<DoorLockClusterClearAllPinsResponseCallback> {
 public:
@@ -1403,35 +1337,6 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPMediaPlaybackClusterPlaybackCallbackBridge : public Callback::Callback<MediaPlaybackClusterPlaybackCallback> {
-public:
-    CHIPMediaPlaybackClusterPlaybackCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<MediaPlaybackClusterPlaybackCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPMediaPlaybackClusterPlaybackCallbackBridge() {};
-
-    static void CallbackFn(void * context)
-    {
-        CHIPMediaPlaybackClusterPlaybackCallbackBridge * callback
-            = reinterpret_cast<CHIPMediaPlaybackClusterPlaybackCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {});
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
 class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterAddSceneResponseCallback> {
 public:
     CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
@@ -4577,89 +4482,6 @@ private:
 
 @end
 
-@interface CHIPContentLaunch ()
-@property (readonly) Controller::ContentLaunchCluster cppCluster;
-@end
-
-@implementation CHIPContentLaunch
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)launchContent:(ResponseHandler)completionHandler
-{
-    CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * onSuccess
-        = new CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.LaunchContent(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)launchURL:(ResponseHandler)completionHandler
-{
-    CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * onSuccess
-        = new CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.LaunchURL(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-@end
-
 @interface CHIPDoorLock ()
 @property (readonly) Controller::DoorLockCluster cppCluster;
 @end
@@ -6244,286 +6066,6 @@ private:
 
 @end
 
-@interface CHIPMediaPlayback ()
-@property (readonly) Controller::MediaPlaybackCluster cppCluster;
-@end
-
-@implementation CHIPMediaPlayback
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)fastForwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.FastForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)nextRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.NextRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)pauseRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PauseRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)playRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PlayRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)previousRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PreviousRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)rewindRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.RewindRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)skipBackwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.SkipBackwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)skipForwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.SkipForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)startOverRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.StartOverRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)stopRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.StopRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeCurrentState:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentState(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-@end
-
 @interface CHIPOnOff ()
 @property (readonly) Controller::OnOffCluster cppCluster;
 @end
index 3adebeb..77b9ff3 100644 (file)
@@ -39,77 +39,6 @@ namespace app {
 
 namespace clusters {
 
-namespace ContentLaunch {
-
-void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID: {
-            CHIP_ERROR TLVError = CHIP_NO_ERROR;
-            uint8_t contentLaunchStatus;
-
-            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
-            {
-                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
-                {
-                case 0:
-                    TLVError = dataTlv.Get(contentLaunchStatus);
-                    break;
-                default:
-                    // Unsupported tag, ignore it.
-                    ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
-                    break;
-                }
-                if (TLVError != CHIP_NO_ERROR)
-                {
-                    ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
-                                    TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
-                }
-            }
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchContentResponseCallback(contentLaunchStatus);
-            break;
-        }
-        case ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID: {
-            CHIP_ERROR TLVError = CHIP_NO_ERROR;
-            uint8_t contentLaunchStatus;
-
-            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
-            {
-                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
-                {
-                case 0:
-                    TLVError = dataTlv.Get(contentLaunchStatus);
-                    break;
-                default:
-                    // Unsupported tag, ignore it.
-                    ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
-                    break;
-                }
-                if (TLVError != CHIP_NO_ERROR)
-                {
-                    ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
-                                    TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
-                }
-            }
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchURLResponseCallback(contentLaunchStatus);
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace ContentLaunch
-
 namespace DoorLock {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -1144,30 +1073,6 @@ void DispatchClientCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace Identify
 
-namespace MediaPlayback {
-
-void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_PLAYBACK_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPlaybackCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace MediaPlayback
-
 namespace Scenes {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
index 6ca0739..0fd312a 100644 (file)
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Media Playback
+
+// Client attributes
+
+// Server attributes
+#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
+
 // Attribute ids for cluster: Low Power
 
 // Client attributes
 
 // Server attributes
 
+// Attribute ids for cluster: Content Launch
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
 
-// Attribute ids for cluster: Media Playback
-
-// Client attributes
-
-// Server attributes
-#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
-
-// Attribute ids for cluster: Content Launch
-
-// Client attributes
-
-// Server attributes
-
 // Attribute ids for cluster: Group Key Management
 
 // Client attributes
index 1105f41..66538a8 100644 (file)
@@ -33,14 +33,12 @@ EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterComma
 EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfContentLaunchClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLevelControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfMediaPlaybackClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd);
@@ -94,9 +92,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             // No commands are enabled for cluster Color Control
             result = status(false, true, cmd->mfgSpecific);
             break;
-        case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-            result = emberAfContentLaunchClusterClientCommandParse(cmd);
-            break;
         case ZCL_DOOR_LOCK_CLUSTER_ID:
             result = emberAfDoorLockClusterClientCommandParse(cmd);
             break;
@@ -117,9 +112,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             // No commands are enabled for cluster Low Power
             result = status(false, true, cmd->mfgSpecific);
             break;
-        case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-            result = emberAfMediaPlaybackClusterClientCommandParse(cmd);
-            break;
         case ZCL_ON_OFF_CLUSTER_ID:
             // No commands are enabled for cluster On/off
             result = status(false, true, cmd->mfgSpecific);
@@ -151,48 +143,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
 
 // Cluster specific command parsing
 
-EmberAfStatus emberAfContentLaunchClusterClientCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID: {
-            uint16_t payloadOffset = cmd->payloadStartIndex;
-            uint8_t contentLaunchStatus;
-
-            if (cmd->bufLen < payloadOffset + 1)
-            {
-                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
-            }
-            contentLaunchStatus = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
-
-            wasHandled = emberAfContentLaunchClusterLaunchContentResponseCallback(contentLaunchStatus);
-            break;
-        }
-        case ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID: {
-            uint16_t payloadOffset = cmd->payloadStartIndex;
-            uint8_t contentLaunchStatus;
-
-            if (cmd->bufLen < payloadOffset + 1)
-            {
-                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
-            }
-            contentLaunchStatus = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
-
-            wasHandled = emberAfContentLaunchClusterLaunchURLResponseCallback(contentLaunchStatus);
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
@@ -919,26 +869,6 @@ EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * c
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfMediaPlaybackClusterClientCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_PLAYBACK_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPlaybackCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index 45377fe..2e044ef 100644 (file)
@@ -44,9 +44,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         emberAfColorControlClusterInitCallback(endpoint);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        emberAfContentLaunchClusterInitCallback(endpoint);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         emberAfDoorLockClusterInitCallback(endpoint);
         break;
@@ -65,9 +62,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_LOW_POWER_CLUSTER_ID:
         emberAfLowPowerClusterInitCallback(endpoint);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        emberAfMediaPlaybackClusterInitCallback(endpoint);
-        break;
     case ZCL_ON_OFF_CLUSTER_ID:
         emberAfOnOffClusterInitCallback(endpoint);
         break;
@@ -108,11 +102,6 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfContentLaunchClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -143,11 +132,6 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfMediaPlaybackClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index c3243df..0de9f0d 100644 (file)
@@ -79,14 +79,6 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Content Launch Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Door Lock Cluster Init
  *
  * Cluster Init
@@ -135,14 +127,6 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Media Playback Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief On/off Cluster Init
  *
  * Cluster Init
@@ -520,76 +504,6 @@ EmberAfStatus emberAfColorControlClusterClientPreAttributeChangedCallback(chip::
 void emberAfColorControlClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
-// Content Launch Cluster client
-//
-
-/** @brief Content Launch Cluster Client Init
- *
- * Client Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterClientInitCallback(chip::EndpointId endpoint);
-
-/** @brief Content Launch Cluster Client Attribute Changed
- *
- * Client Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfContentLaunchClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Content Launch Cluster Client Manufacturer Specific Attribute Changed
- *
- * Client Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Content Launch Cluster Client Message Sent
- *
- * Client Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Content Launch Cluster Client Pre Attribute Changed
- *
- * client Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfContentLaunchClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Content Launch Cluster Client Tick
- *
- * client Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfContentLaunchClusterClientTickCallback(chip::EndpointId endpoint);
-
-//
 // Door Lock Cluster client
 //
 
@@ -1011,76 +925,6 @@ EmberAfStatus emberAfLowPowerClusterClientPreAttributeChangedCallback(chip::Endp
 void emberAfLowPowerClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
-// Media Playback Cluster client
-//
-
-/** @brief Media Playback Cluster Client Init
- *
- * Client Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterClientInitCallback(chip::EndpointId endpoint);
-
-/** @brief Media Playback Cluster Client Attribute Changed
- *
- * Client Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfMediaPlaybackClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Media Playback Cluster Client Manufacturer Specific Attribute Changed
- *
- * Client Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Media Playback Cluster Client Message Sent
- *
- * Client Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Media Playback Cluster Client Pre Attribute Changed
- *
- * client Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfMediaPlaybackClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Media Playback Cluster Client Tick
- *
- * client Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfMediaPlaybackClusterClientTickCallback(chip::EndpointId endpoint);
-
-//
 // On/off Cluster client
 //
 
@@ -1292,20 +1136,6 @@ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId end
 // Cluster Commands Callback
 
 /**
- * @brief Content Launch Cluster LaunchContentResponse Command callback
- * @param contentLaunchStatus
- */
-
-bool emberAfContentLaunchClusterLaunchContentResponseCallback(uint8_t contentLaunchStatus);
-
-/**
- * @brief Content Launch Cluster LaunchURLResponse Command callback
- * @param contentLaunchStatus
- */
-
-bool emberAfContentLaunchClusterLaunchURLResponseCallback(uint8_t contentLaunchStatus);
-
-/**
  * @brief Door Lock Cluster ClearAllPinsResponse Command callback
  * @param status
  */
@@ -1566,12 +1396,6 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou
 bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout);
 
 /**
- * @brief Media Playback Cluster Playback Command callback
- */
-
-bool emberAfMediaPlaybackClusterPlaybackCallback();
-
-/**
  * @brief Scenes Cluster AddSceneResponse Command callback
  * @param status
  * @param groupId
index 79d1e15..775f29f 100644 (file)
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for PlayRequest
+ *
+ * Command: PlayRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PauseRequest
+ *
+ * Command: PauseRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
+                                                                                                                                   \
+                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StopRequest
+ *
+ * Command: StopRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StartOverRequest
+ *
+ * Command: StartOverRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
+                                                                                                                                   \
+                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PreviousRequest
+ *
+ * Command: PreviousRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
+                                                                                                                                   \
+                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for NextRequest
+ *
+ * Command: NextRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for RewindRequest
+ *
+ * Command: RewindRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
+                                                                                                                                   \
+                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for FastForwardRequest
+ *
+ * Command: FastForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipForwardRequest
+ *
+ * Command: SkipForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipBackwardRequest
+ *
+ * Command: SkipBackwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
+                                                                                                                                   \
+                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
+
 /** @brief Command description for Sleep
  *
  * Command: Sleep
                                                                                                                                    \
                                                   ZCL_SLEEP_COMMAND_ID, "", );
 
+/** @brief Command description for LaunchContent
+ *
+ * Command: LaunchContent
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
+        emberAfFillExternalBuffer(mask,                                                                                            \
+                                                                                                                                   \
+                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
+
+/** @brief Command description for LaunchURL
+ *
+ * Command: LaunchURL
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
+                                                                                                                                   \
+                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
                                                                                                                                    \
                               ZCL_UNBIND_COMMAND_ID, "uuuu", nodeId, groupId, endpointId, clusterId);
 
-/** @brief Command description for PlayRequest
- *
- * Command: PlayRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PauseRequest
- *
- * Command: PauseRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
-                                                                                                                                   \
-                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StopRequest
- *
- * Command: StopRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StartOverRequest
- *
- * Command: StartOverRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
-                                                                                                                                   \
-                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PreviousRequest
- *
- * Command: PreviousRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
-                                                                                                                                   \
-                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for NextRequest
- *
- * Command: NextRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for RewindRequest
- *
- * Command: RewindRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
-                                                                                                                                   \
-                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for FastForwardRequest
- *
- * Command: FastForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipForwardRequest
- *
- * Command: SkipForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipBackwardRequest
- *
- * Command: SkipBackwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
-                                                                                                                                   \
-                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for LaunchContent
- *
- * Command: LaunchContent
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
-        emberAfFillExternalBuffer(mask,                                                                                            \
-                                                                                                                                   \
-                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
-
-/** @brief Command description for LaunchURL
- *
- * Command: LaunchURL
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
-                                                                                                                                   \
-                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
-
 /** @brief Command description for CommandOne
  *
  * Command: CommandOne
index 9e82931..499adf9 100644 (file)
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Media Playback
+#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0x0506)
+
 // Definitions for cluster: Low Power
 #define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
 
+// Definitions for cluster: Content Launch
+#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0x050A)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
 // Definitions for cluster: Binding
 #define ZCL_BINDING_CLUSTER_ID (0xF000)
 
-// Definitions for cluster: Media Playback
-#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0xF001)
-
-// Definitions for cluster: Content Launch
-#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0xF002)
-
 // Definitions for cluster: Group Key Management
 #define ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID (0xF004)
 
index 864943b..268678a 100644 (file)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Media Playback
+#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
+#define ZCL_PLAYBACK_COMMAND_ID (0x00)
+#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
+#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
+#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
+#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
+#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
+#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
+#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
+#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
+#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
+
 // Commands for cluster: Low Power
 #define ZCL_SLEEP_COMMAND_ID (0x00)
 
+// Commands for cluster: Content Launch
+#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
+#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_BIND_COMMAND_ID (0x00)
 #define ZCL_UNBIND_COMMAND_ID (0x01)
 
-// Commands for cluster: Media Playback
-#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
-#define ZCL_PLAYBACK_COMMAND_ID (0x00)
-#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
-#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
-#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
-#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
-#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
-#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
-#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
-#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
-#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
-
-// Commands for cluster: Content Launch
-#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
-#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
-
 // Commands for cluster: Sample Mfg Specific Cluster
 #define ZCL_COMMAND_ONE_COMMAND_ID (0x00)
 
index 5816559..0c5f81d 100644 (file)
@@ -63,7 +63,7 @@
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 16
+#define GENERATED_ATTRIBUTE_COUNT 14
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
         { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                                 \
               ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (client): cluster revision */                                     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
               ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (client): cluster revision */                                               \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
-              ZAP_SIMPLE_DEFAULT(0x0001) }, /* Media Playback (client): cluster revision */                                        \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
-              ZAP_SIMPLE_DEFAULT(0x0001) }, /* Content Launch (client): cluster revision */                                        \
     }
 
 // This is an array of EmberAfCluster structures.
 #define GENERATED_FUNCTION_ARRAYS
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 16
+#define GENERATED_CLUSTER_COUNT 14
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */    \
             {                                                                                                                      \
                 0xF000, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Binding (client) */                                                                        \
-            {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
-            }, /* Endpoint: 1, Cluster: Media Playback (client) */                                                                 \
-            {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
-            }, /* Endpoint: 1, Cluster: Content Launch (client) */                                                                 \
     }
 
 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 16, 32 },                                                                                          \
+        { ZAP_CLUSTER_INDEX(0), 14, 28 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_SINGLETONS_SIZE (2)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (32)
+#define ATTRIBUTE_MAX_SIZE (28)
 
 // Number of fixed endpoints
 #define FIXED_ENDPOINT_COUNT (1)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (129)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (114)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (client): Identify */                                 \
             { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Low Power (client): Sleep */                                   \
             { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (client): Bind */                                      \
             { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (client): Unbind */                                    \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PlayRequest */                        \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Media Playback (client): Playback */                           \
-            { 0xF001, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PauseRequest */                       \
-            { 0xF001, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): StopRequest */                        \
-            { 0xF001, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): StartOverRequest */                   \
-            { 0xF001, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PreviousRequest */                    \
-            { 0xF001, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): NextRequest */                        \
-            { 0xF001, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): RewindRequest */                      \
-            { 0xF001, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): FastForwardRequest */                 \
-            { 0xF001, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): SkipForwardRequest */                 \
-            { 0xF001, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): SkipBackwardRequest */                \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (client): LaunchContent */                      \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (client): LaunchContentResponse */              \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (client): LaunchURL */                          \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (client): LaunchURLResponse */                  \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index ce12b68..a61e278 100644 (file)
 #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
-#define EMBER_AF_CONTENT_LAUNCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_GROUPS_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_LEVEL_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_LOW_POWER_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
-#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define ZCL_USING_COLOR_CONTROL_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_CLIENT
 
-// Use this macro to check if the client side of the Content Launch cluster is included
-#define ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH_CLIENT
-
 // Use this macro to check if the client side of the Door Lock cluster is included
 #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT
 #define ZCL_USING_LOW_POWER_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_LOW_POWER_CLIENT
 
-// Use this macro to check if the client side of the Media Playback cluster is included
-#define ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK_CLIENT
-
 // Use this macro to check if the client side of the On/off cluster is included
 #define ZCL_USING_ON_OFF_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_ON_OFF_CLIENT
index e3207b7..5cb5a91 100644 (file)
 #define CHIP_PRINTCLUSTER_IAS_WD_CLUSTER
 #endif
 
+#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 1286, "Media Playback" },
+#else
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
+#endif
+
 #if defined(ZCL_USING_LOW_POWER_CLUSTER_SERVER) || defined(ZCL_USING_LOW_POWER_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER { ZCL_LOW_POWER_CLUSTER_ID, 1288, "Low Power" },
 #else
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER
 #endif
 
+#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 1290, "Content Launch" },
+#else
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
+#endif
+
 #if defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER { ZCL_APPLICATION_BASIC_CLUSTER_ID, 1293, "Application Basic" },
 #else
 #define CHIP_PRINTCLUSTER_BINDING_CLUSTER
 #endif
 
-#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 61441, "Media Playback" },
-#else
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
-#endif
-
-#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 61442, "Content Launch" },
-#else
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
-#endif
-
 #if defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER) || defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER { ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID, 61444, "Group Key Management" },
 #else
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
     CHIP_PRINTCLUSTER_DIAGNOSTICS_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_ZLL_COMMISSIONING_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_BINDING_CLUSTER                                                                                              \
-    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
-    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER                                                                                 \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER                                                                                  \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER_2                                                                                \
index 2f4623a..ed838af 100644 (file)
@@ -136,6 +136,11 @@ public:
         {{/chip_server_cluster_command_arguments}}
         ModelCommand::AddArguments();
     }
+    ~{{asCamelCased clusterName false}}{{asCamelCased name false}}()
+    {
+      delete onSuccessCallback;
+      delete onFailureCallback;
+    }
 
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
@@ -175,6 +180,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~Discover{{asCamelCased name false}}Attributes()
+    {
+      delete onSuccessCallback;
+      delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 4}}) command (0x0C) on endpoint %" PRIu16, endpointId);
@@ -202,6 +213,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~Read{{asCamelCased parent.name false}}{{asCamelCased name false}}()
+    {
+      delete onSuccessCallback;
+      delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 4}}) command (0x00) on endpoint %" PRIu16, endpointId);
@@ -231,6 +248,12 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~Write{{asCamelCased parent.name false}}{{asCamelCased name false}}()
+    {
+      delete onSuccessCallback;
+      delete onFailureCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 4}}) command (0x01) on endpoint %" PRIu16, endpointId);
@@ -266,6 +289,13 @@ public:
         ModelCommand::AddArguments();
     }
 
+    ~Report{{asCamelCased parent.name false}}{{asCamelCased name false}}()
+    {
+      delete onSuccessCallback;
+      delete onFailureCallback;
+      delete onReportCallback;
+    }
+
     CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
     {
         ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 4}}) command (0x06) on endpoint %" PRIu16, endpointId);
index 11cd1c4..6bc5229 100644 (file)
@@ -13,6 +13,17 @@ public:
     Listen() : ReportingCommand("listen")
     {
     }
+
+    ~Listen()
+    {
+{{#chip_clusters}}
+{{#chip_server_cluster_attributes}}
+{{#if (isReportableAttribute)}}
+    delete onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback;
+{{/if}}
+{{/chip_server_cluster_attributes}}
+{{/chip_clusters}}
+    }
     
     void AddReportCallbacks(uint8_t endpointId) override
     {
index 5ce746e..d717d4d 100644 (file)
 import("//build_overrides/pigweed.gni")
 import("$dir_pw_build/target_types.gni")
 
+config("default_config") {
+  include_dirs = [ ".." ]
+}
+
 pw_source_set("system_rpc_server") {
   deps = [
     "$dir_pw_hdlc:pw_rpc",
@@ -24,4 +28,5 @@ pw_source_set("system_rpc_server") {
     dir_pw_log,
   ]
   sources = [ "system_rpc_server.cc" ]
+  public_configs = [ ":default_config" ]
 }
index 5c51a8b..550f353 100644 (file)
@@ -30,7 +30,7 @@
 #include "pw_stream/sys_io_stream.h"
 #include "pw_sys_io/sys_io.h"
 
-#include "logging/CHIPLogging.h"
+#include "support/logging/CHIPLogging.h"
 
 #include <array>
 
index 83fd3a6..c26608b 100644 (file)
@@ -31,6 +31,7 @@ declare_args() {
   # Dump memory usage at link time.
   chip_print_memory_usage = false
   enable_pw_rpc = false
+  setupPinCode = 73141520
 }
 
 show_qr_code = true
@@ -53,7 +54,10 @@ efr32_sdk("sdk") {
     "${efr32_project_dir}/include/FreeRTOSConfig.h",
   ]
 
-  defines = [ "BOARD_ID=${efr32_board}" ]
+  defines = [
+    "BOARD_ID=${efr32_board}",
+    "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
+  ]
 
   if (enable_pw_rpc) {
     defines += [
index 4080a7a..f2040cb 100644 (file)
@@ -39,7 +39,9 @@
 #define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34
 
 // Use a default pairing code if one hasn't been provisioned in flash.
+#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
+#endif
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
 
 // For convenience, Chip Security Test Mode can be enabled and the
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
  *
- * 0xE100: Google's Vendor Id.
+ * 0x235A: Chip's Vendor Id.
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xE100
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Light Resource
+ * 0x534C: EFR32 lighting-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFD00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x534C
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
  * A size, in bytes, of the individual debug event logging buffer.
  */
 #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
+ *
+ * The interval (in units of 0.625ms) at which the device will send BLE advertisements while
+ * in fast advertising mode.
+ *
+ * 40 (25ms).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL 40
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL
+ *
+ * The interval (in units of 0.625ms) at which the device will send BLE advertisements while
+ * in slow advertisement mode.
+ *
+ * 800 (500ms).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL 800
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT
+ *
+ * The amount of time in miliseconds after which BLE should change his advertisements
+ * from fast interval to slow interval.
+ *
+ * 30000 (30 secondes).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT (30 * 1000)
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT
+ *
+ * The amount of time in miliseconds after which BLE advertisement should be disabled, counting
+ * from the moment of slow advertisement commencement.
+ *
+ * Defaults to 9000000 (15 minutes).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000)
index f6cb21b..4db0211 100644 (file)
@@ -29,6 +29,7 @@
 #include <mbedtls/threading.h>
 
 #include <platform/CHIPDeviceLayer.h>
+#include <platform/KeyValueStoreManager.h>
 #include <support/CHIPMem.h>
 #include <support/CHIPPlatformMemory.h>
 
@@ -116,6 +117,7 @@ int main(void)
 
     // Init Chip memory management before the stack
     chip::Platform::MemoryInit();
+    chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
 
     ret = PlatformMgr().InitChipStack();
     if (ret != CHIP_NO_ERROR)
index 4908f99..857f415 100644 (file)
 
 #pragma once
 
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
+ *
+ * 0x4E4C: nrfconnect lighting-app
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x4E4C
+
 // Use a default pairing code if one hasn't been provisioned in flash.
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
index 160f080..099f492 100644 (file)
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
  *
- * 0xE100: Google's Vendor Id.
+ * 0x235A: Chip's Vendor Id.
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xE100
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Lock Resource
+ * 0x434B: cc13x2x7_26x2x7 lock-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x434B
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
index b4c9618..0c6b436 100644 (file)
@@ -28,6 +28,7 @@ examples_plat_dir = "${chip_root}/examples/platform/efr32"
 declare_args() {
   # Dump memory usage at link time.
   chip_print_memory_usage = false
+  setupPinCode = 73141520
 }
 
 show_qr_code = true
@@ -50,7 +51,10 @@ efr32_sdk("sdk") {
     "${efr32_project_dir}/include/FreeRTOSConfig.h",
   ]
 
-  defines = [ "BOARD_ID=${efr32_board}" ]
+  defines = [
+    "BOARD_ID=${efr32_board}",
+    "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
+  ]
 }
 
 efr32_executable("lock_app") {
index 0e8ce99..17da147 100644 (file)
@@ -39,7 +39,9 @@
 #define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34
 
 // Use a default pairing code if one hasn't been provisioned in flash.
+#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
+#endif
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
 
 // For convenience, Chip Security Test Mode can be enabled and the
@@ -61,9 +63,9 @@
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Lock Resource
+ * 0x534B: EFR32 lock-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x534B
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
  * A size, in bytes, of the individual debug event logging buffer.
  */
 #define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
+ *
+ * The interval (in units of 0.625ms) at which the device will send BLE advertisements while
+ * in fast advertising mode.
+ *
+ * 40 (25ms).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL 40
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL
+ *
+ * The interval (in units of 0.625ms) at which the device will send BLE advertisements while
+ * in slow advertisement mode.
+ *
+ * 800 (500ms).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL 800
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT
+ *
+ * The amount of time in miliseconds after which BLE should change his advertisements
+ * from fast interval to slow interval.
+ *
+ * 30000 (30 secondes).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT (30 * 1000)
+
+/**
+ * CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT
+ *
+ * The amount of time in miliseconds after which BLE advertisement should be disabled, counting
+ * from the moment of slow advertisement commencement.
+ *
+ * Defaults to 9000000 (15 minutes).
+ */
+#define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000)
index 76283b3..2e60ca2 100644 (file)
@@ -29,6 +29,7 @@
 #include <mbedtls/threading.h>
 
 #include <platform/CHIPDeviceLayer.h>
+#include <platform/KeyValueStoreManager.h>
 #include <support/CHIPMem.h>
 #include <support/CHIPPlatformMemory.h>
 
@@ -107,6 +108,7 @@ int main(void)
 
     // Init Chip memory management before the stack
     chip::Platform::MemoryInit();
+    chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
 
     ret = PlatformMgr().InitChipStack();
     if (ret != CHIP_NO_ERROR)
index 4908f99..01a6f88 100644 (file)
 
 #pragma once
 
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
+ *
+ * 0x4E4B: nrfconnect lock-app
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x4E4B
+
 // Use a default pairing code if one hasn't been provisioned in flash.
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
index 2f217b9..a3369f1 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <platform/KeyValueStoreManager.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 using namespace chip::DeviceLayer::PersistedStorage;
index ff2283a..e07a2e6 100644 (file)
@@ -54,9 +54,9 @@
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
  *
- * 0xE100: Google's Vendor Id.
+ * 0x235A: Chip's Vendor Id.
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xE100
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
diff --git a/examples/persistent-storage/esp32/CMakeLists.txt b/examples/persistent-storage/esp32/CMakeLists.txt
new file mode 100644 (file)
index 0000000..54ea092
--- /dev/null
@@ -0,0 +1,28 @@
+#
+#    Copyright (c) 2021 Project CHIP Authors
+#    All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.5)
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+
+# The list of extra component dirs must be in sync with that in persistent-storage/esp32/Makefile
+set(EXTRA_COMPONENT_DIRS
+    "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
+)
+
+project(persistent-storage)
+idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
+idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
index 0669e35..1f896bf 100644 (file)
@@ -59,21 +59,36 @@ step. To install these components manually, follow these steps:
 Currently building in VSCode _and_ deploying from native is not supported, so
 make sure the IDF_PATH has been exported(See the manual setup steps above).
 
--   In the root of the example directory, sync the CHIP tree's submodules and
-    source `idf.sh`. Note: This does not have to be repeated for incremental
-    builds.
+-   Setting up the environment
 
-          $ source idf.sh
+To download and install packages.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/bootstrap.sh
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
+
+If packages are already installed then simply activate it.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
 
 -   Configuration Options
 
-        To use the default configuration options, run the default config
+        To choose from the different configuration options, run menuconfig
 
-          $ idf make defconfig
+          $ idf.py menuconfig
 
--   Run make to build the demo application.
+-   To build the demo application.
 
-          $ idf make
+          $ idf.py build
 
 <a name="flashing"></a>
 
@@ -88,7 +103,7 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
     before flashing. For ESP32-DevKitC devices this is labeled in the
     [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
 
-          $ idf make flash ESPPORT=/dev/tty.SLAB_USBtoUART
+          $ idf.py flash monitor ESPPORT=/dev/tty.SLAB_USBtoUART
 
     Note: Some users might have to install the
     [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
diff --git a/examples/persistent-storage/esp32/main/CMakeLists.txt b/examples/persistent-storage/esp32/main/CMakeLists.txt
new file mode 100644 (file)
index 0000000..17494ef
--- /dev/null
@@ -0,0 +1,28 @@
+#
+#    Copyright (c) 2021 Project CHIP Authors
+#    All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+# The list of src and include dirs must be in sync with that in persistent-storage/esp32/main/component.mk
+idf_component_register(PRIV_INCLUDE_DIRS 
+                      "${CMAKE_CURRENT_LIST_DIR}"
+                      "${CMAKE_SOURCE_DIR}/.."
+                      SRC_DIRS
+                      "${CMAKE_CURRENT_LIST_DIR}"
+                      "${CMAKE_SOURCE_DIR}/.."
+                      PRIV_REQUIRES chip nvs_flash)
+
+set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
+target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
index 0681b49..484bd05 100644 (file)
@@ -25,3 +25,7 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
 # Use a custom partition table
 CONFIG_PARTITION_TABLE_CUSTOM=y
 CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
+
+# Vendor and product id
+CONFIG_DEVICE_VENDOR_ID=0x235A
+CONFIG_DEVICE_PRODUCT_ID=0x4553
index a639e00..0fcca37 100644 (file)
@@ -38,12 +38,13 @@ efr32_sdk("sdk") {
   sources = [
     "${efr32_project_dir}/include/CHIPProjectConfig.h",
     "${efr32_project_dir}/include/FreeRTOSConfig.h",
+    "${efr32_sdk_root}/hardware/kit/common/drivers/retargetserial.c",
   ]
 
   defines = [
     "BOARD_ID=${efr32_board}",
-    "HAL_VCOM_ENABLE = 1",
-    "EFR32_LOG_ENABLED = 1",
+    "HAL_VCOM_ENABLE=1",
+    "EFR32_LOG_ENABLED=1",
     "PW_RPC_ENABLED",
   ]
 }
@@ -58,37 +59,12 @@ efr32_executable("pigweed_app") {
     "$dir_pw_assert",
     "$dir_pw_checksum",
     "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
+    "${chip_root}/examples/common/pigweed:system_rpc_server",
     "${chip_root}/src/lib",
     "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32",
   ]
 
-  include_dirs += [
-    "include",
-    "${examples_plat_dir}",
-    "${examples_plat_dir}/${efr32_family}/${efr32_board}",
-    "${examples_plat_dir}/pw_sys_io/public",
-    "${dir_pigweed}/pw_sys_io/public",
-    "${dir_pigweed}/pw_span/public_overrides",
-    "${dir_pigweed}/pw_span/public",
-    "${dir_pigweed}/pw_polyfill/public",
-    "${dir_pigweed}/pw_polyfill/standard_library_public",
-    "${dir_pigweed}/pw_polyfill/public_overrides",
-    "${dir_pigweed}/pw_status/public",
-    "${dir_pigweed}/pw_stream/public",
-    "${dir_pigweed}/pw_preprocessor/public",
-    "${dir_pigweed}/pw_rpc/public",
-    "${dir_pigweed}/pw_rpc/nanopb/public",
-    "${dir_pigweed}/pw_rpc/raw/public",
-    "${dir_pigweed}/pw_rpc/system_server/public",
-    "${dir_pigweed}/pw_protobuf/public",
-    "${dir_pigweed}/pw_result/public",
-    "${dir_pigweed}/pw_varint/public",
-    "${chip_root}/third_party/nanopb/repo",
-    "${chip_root}/src/lib/support",
-    "${chip_root}/examples/common",
-    "${chip_root}/examples/common/pigweed/efr32",
-    "out/debug/gen/third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc/protos",
-  ]
+  include_dirs += [ "${chip_root}/examples/common/pigweed/efr32" ]
 
   sources = [
     "${chip_root}/examples/common/pigweed/RpcService.cpp",
index ef9dbc5..dc96c79 100644 (file)
@@ -60,9 +60,9 @@
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Lock Resource
+ * 0x5350: EFR32 pigweed-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x5350
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
index e4ce5ed..b62c11c 100644 (file)
@@ -41,3 +41,7 @@ CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
 
 # Enable Pigweed RPC Library in CHIP
 CONFIG_ENABLE_PW_RPC=y
+
+# Vendor and product id
+CONFIG_DEVICE_VENDOR_ID=0x235A
+CONFIG_DEVICE_PRODUCT_ID=0x4550
index 82f0cd6..164995f 100644 (file)
@@ -80,9 +80,9 @@
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Lock Resource
+ * 0x4B4C: K32W lighting-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x4B4C
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
index 07a23de..e1d13e1 100644 (file)
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
  *
- * 0xE100: Google's Vendor Id.
+ * 0x235A: Chip's Vendor Id.
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xE100
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
  *
- * 0xFE00: SDK Sample Lock Resource
+ * 0x514C: qpg6100 lighting-app
  */
-#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0xFE00
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x514C
 
 /**
  * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
index 3438795..8d7b2d6 100644 (file)
 #define CHIP_CONFIG_ENABLE_ARG_PARSER 1
 
 #define CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING 1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
+ *
+ * 0x4E53: nrfconnect shell
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x4E53
index d1e95b9..b439d4e 100644 (file)
@@ -38,6 +38,7 @@ target_sources(app PRIVATE
     ${APP_ROOT}/shell_common/cmd_device.cpp
     ${APP_ROOT}/shell_common/cmd_misc.cpp
     ${APP_ROOT}/shell_common/cmd_otcli.cpp
+    ${APP_ROOT}/shell_common/cmd_ping.cpp    
     ${APP_ROOT}/shell_common/cmd_btp.cpp
     ${APP_ROOT}/standalone/main.cpp
 )
index 4f6acb7..ac079f2 100644 (file)
@@ -962,8 +962,10 @@ void cmd_device_init()
 
 #if CHIP_DEVICE_CONFIG_ENABLE_THREAD
     streamer_printf(sout, "Init Thread stack\r\n");
-    error = ThreadStackMgr().InitThreadStack();
-    VerifyOrExit(error == CHIP_NO_ERROR, streamer_printf(sout, "ThreadStackMgr().InitThreadStack() failed\r\n"));
+    if (ThreadStackMgr().InitThreadStack() != CHIP_NO_ERROR)
+    {
+        streamer_printf(sout, "ThreadStackMgr().InitThreadStack() failed\r\n");
+    }
 #endif
 
     // Starting Platform Manager Event Loop;
index f1a1ad0..da55860 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <core/CHIPCore.h>
+#include <lib/core/CHIPCore.h>
+#include <lib/shell/shell.h>
+#include <lib/support/CodeUtils.h>
+#include <lib/support/ErrorStr.h>
 #include <messaging/ExchangeMgr.h>
 #include <platform/CHIPDeviceLayer.h>
 #include <protocols/echo/Echo.h>
-#include <shell/shell.h>
-#include <support/CodeUtils.h>
-#include <support/ErrorStr.h>
 #include <system/SystemPacketBuffer.h>
 #include <transport/PASESession.h>
 #include <transport/SecureSessionMgr.h>
@@ -38,10 +38,11 @@ using namespace chip;
 using namespace Shell;
 using namespace Logging;
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
 constexpr size_t kMaxTcpActiveConnectionCount = 4;
 constexpr size_t kMaxTcpPendingPackets        = 4;
-constexpr size_t kNetworkSleepTimeMsecs       = (100 * 1000);
-constexpr size_t kDecimalDigitsForUint64      = 20;
+#endif
+constexpr size_t kDecimalDigitsForUint64 = 20;
 
 namespace {
 
@@ -56,9 +57,11 @@ public:
         mEchoCount          = 0;
         mEchoRespCount      = 0;
         mWaitingForEchoResp = false;
-        mUsingTCP           = false;
-        mUsingCRMP          = true;
-        mEchoPort           = CHIP_PORT;
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
+        mUsingTCP = false;
+#endif
+        mUsingCRMP = true;
+        mEchoPort  = CHIP_PORT;
     }
 
     uint64_t GetLastEchoTime() const { return mLastEchoTime; }
@@ -84,8 +87,10 @@ public:
     bool IsWaitingForEchoResp() const { return mWaitingForEchoResp; }
     void SetWaitingForEchoResp(bool value) { mWaitingForEchoResp = value; }
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     bool IsUsingTCP() const { return mUsingTCP; }
     void SetUsingTCP(bool value) { mUsingTCP = value; }
+#endif
 
     bool IsUsingCRMP() const { return mUsingCRMP; }
     void SetUsingCRMP(bool value) { mUsingCRMP = value; }
@@ -112,15 +117,23 @@ private:
     // after sending an echo request, false otherwise.
     bool mWaitingForEchoResp;
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     bool mUsingTCP;
+#endif
+
     bool mUsingCRMP;
 } gPingArguments;
 
 constexpr Transport::AdminId gAdminId = 0;
 
 Protocols::Echo::EchoClient gEchoClient;
+
 TransportMgr<Transport::UDP> gUDPManager;
+
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
 TransportMgr<Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
+#endif
+
 Messaging::ExchangeManager gExchangeManager;
 SecureSessionMgr gSessionManager;
 Inet::IPAddress gDestAddr;
@@ -184,11 +197,13 @@ CHIP_ERROR EstablishSecureSession(streamer_t * stream)
     SecurePairingUsingTestSecret * testSecurePairingSecret = chip::Platform::New<SecurePairingUsingTestSecret>();
     VerifyOrExit(testSecurePairingSecret != nullptr, err = CHIP_ERROR_NO_MEMORY);
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     if (gPingArguments.IsUsingTCP())
     {
         peerAddr = Optional<Transport::PeerAddress>::Value(Transport::PeerAddress::TCP(gDestAddr, gPingArguments.GetEchoPort()));
     }
     else
+#endif
     {
         peerAddr = Optional<Transport::PeerAddress>::Value(
             Transport::PeerAddress::UDP(gDestAddr, gPingArguments.GetEchoPort(), INET_NULL_INTERFACEID));
@@ -227,44 +242,6 @@ void HandleEchoResponseReceived(Messaging::ExchangeContext * ec, System::PacketB
                     payload->DataLength(), static_cast<double>(transitTime) / 1000);
 }
 
-void DriveIO(streamer_t * stream)
-{
-    struct timeval sleepTime;
-    fd_set readFDs, writeFDs, exceptFDs;
-    int numFDs = 0;
-    int selectRes;
-
-    sleepTime.tv_sec  = 0;
-    sleepTime.tv_usec = kNetworkSleepTimeMsecs;
-
-    FD_ZERO(&readFDs);
-    FD_ZERO(&writeFDs);
-    FD_ZERO(&exceptFDs);
-
-    if (chip::DeviceLayer::SystemLayer.State() == chip::System::kLayerState_Initialized)
-        chip::DeviceLayer::SystemLayer.PrepareSelect(numFDs, &readFDs, &writeFDs, &exceptFDs, sleepTime);
-
-    if (chip::DeviceLayer::InetLayer.State == chip::Inet::InetLayer::kState_Initialized)
-        chip::DeviceLayer::InetLayer.PrepareSelect(numFDs, &readFDs, &writeFDs, &exceptFDs, sleepTime);
-
-    selectRes = select(numFDs, &readFDs, &writeFDs, &exceptFDs, &sleepTime);
-    if (selectRes < 0)
-    {
-        streamer_printf(stream, "Select failed: %s\n", chip::ErrorStr(chip::System::MapErrorPOSIX(errno)));
-        return;
-    }
-
-    if (chip::DeviceLayer::SystemLayer.State() == chip::System::kLayerState_Initialized)
-    {
-        chip::DeviceLayer::SystemLayer.HandleSelectResult(selectRes, &readFDs, &writeFDs, &exceptFDs);
-    }
-
-    if (chip::DeviceLayer::InetLayer.State == chip::Inet::InetLayer::kState_Initialized)
-    {
-        chip::DeviceLayer::InetLayer.HandleSelectResult(selectRes, &readFDs, &writeFDs, &exceptFDs);
-    }
-}
-
 void StartPinging(streamer_t * stream, char * destination)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
@@ -282,16 +259,19 @@ void StartPinging(streamer_t * stream, char * destination)
     adminInfo = admins.AssignAdminId(gAdminId, kTestControllerNodeId);
     VerifyOrExit(adminInfo != nullptr, err = CHIP_ERROR_NO_MEMORY);
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer)
-                               .SetAddressType(Inet::kIPAddressType_IPv4)
+                               .SetAddressType(gDestAddr.Type())
                                .SetListenPort(gPingArguments.GetEchoPort() + 1));
-    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init TCP manager error: %s\r\n", ErrorStr(err)));
+    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init TCP manager error: %s\n", ErrorStr(err)));
+#endif
 
     err = gUDPManager.Init(Transport::UdpListenParameters(&DeviceLayer::InetLayer)
-                               .SetAddressType(Inet::kIPAddressType_IPv4)
+                               .SetAddressType(gDestAddr.Type())
                                .SetListenPort(gPingArguments.GetEchoPort() + 1));
-    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init UDP manager error: %s\r\n", ErrorStr(err)));
+    VerifyOrExit(err == CHIP_NO_ERROR, streamer_printf(stream, "Failed to init UDP manager error: %s\n", ErrorStr(err)));
 
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     if (gPingArguments.IsUsingTCP())
     {
         err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gTCPManager, &admins);
@@ -301,6 +281,7 @@ void StartPinging(streamer_t * stream, char * destination)
         SuccessOrExit(err);
     }
     else
+#endif
     {
         err = gSessionManager.Init(kTestControllerNodeId, &DeviceLayer::SystemLayer, &gUDPManager, &admins);
         SuccessOrExit(err);
@@ -326,6 +307,7 @@ void StartPinging(streamer_t * stream, char * destination)
     for (unsigned int i = 0; i < maxEchoCount; i++)
     {
         err = SendEchoRequest(stream);
+
         if (err != CHIP_NO_ERROR)
         {
             streamer_printf(stream, "Send request failed: %s\n", ErrorStr(err));
@@ -335,7 +317,8 @@ void StartPinging(streamer_t * stream, char * destination)
         // Wait for response until the Echo interval.
         while (!EchoIntervalExpired())
         {
-            DriveIO(stream);
+            // TODO:#5496: Use condition_varible to suspend the current thread and wake it up when response arrive.
+            sleep(1);
         }
 
         // Check if expected response was received.
@@ -364,8 +347,10 @@ void PrintUsage(streamer_t * stream)
     // Need to split the help info to prevent overflowing the streamer_printf
     // buffer (CONSOLE_DEFAULT_MAX_LINE 256)
     streamer_printf(stream, "  -h              print help information\n");
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
     streamer_printf(stream, "  -u              use UDP (default)\n");
     streamer_printf(stream, "  -t              use TCP\n");
+#endif
     streamer_printf(stream, "  -p  <port>      echo server port\n");
     streamer_printf(stream, "  -i  <interval>  ping interval time in seconds\n");
     streamer_printf(stream, "  -c  <count>     stop after <count> replies\n");
@@ -387,12 +372,14 @@ int cmd_ping(int argc, char ** argv)
         case 'h':
             PrintUsage(sout);
             return 0;
+#if INET_CONFIG_ENABLE_TCP_ENDPOINT
         case 'u':
             gPingArguments.SetUsingTCP(false);
             break;
         case 't':
             gPingArguments.SetUsingTCP(true);
             break;
+#endif
         case 'i':
             if (++optIndex >= argc || argv[optIndex][0] == '-')
             {
index 9642f33..e1b7e10 100644 (file)
@@ -45,10 +45,7 @@ int main()
     cmd_device_init();
     cmd_btp_init();
     cmd_otcli_init();
-
-#ifndef CHIP_DEVICE_CONFIG_DISABLE_SHELL_PING
     cmd_ping_init();
-#endif
 
     shell_task(nullptr);
     return 0;
diff --git a/examples/temperature-measurement-app/esp32/CMakeLists.txt b/examples/temperature-measurement-app/esp32/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e1a94d2
--- /dev/null
@@ -0,0 +1,32 @@
+#
+#    Copyright (c) 2021 Project CHIP Authors
+#    All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+
+# The following lines of boilerplate have to be in your project's
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.5)
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+
+# The list of extra component dirs must be in sync with that in temperature-measurement-app/esp32/Makefile
+set(EXTRA_COMPONENT_DIRS
+    "${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
+    "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components"
+    "${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode"
+    "${CMAKE_CURRENT_LIST_DIR}/../../common/screen-framework"
+)
+
+project(chip-temperature-measurement-app)
+idf_build_set_property(CXX_COMPILE_OPTIONS "-std=c++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
+idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
index 82dca0e..0ef22f8 100644 (file)
@@ -28,17 +28,32 @@ step. To install these components manually, follow these steps:
 Currently building in VSCode _and_ deploying from native is not supported, so
 make sure the IDF_PATH has been exported(See the manual setup steps above).
 
--   In the root of the example directory, sync the CHIP tree's submodules and
-    source `idf.sh`. Note: This does not have to be repeated for incremental
-    builds.
+-   Setting up the environment
 
-          $ source idf.sh
+To download and install packages.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/bootstrap.sh
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
+
+If packages are already installed then simply activate it.
+
+        $ cd ${HOME}/tools/esp-idf
+        $ ./install.sh
+        $ . ./export.sh
+        $ cd {path-to-connectedhomeip}
+        $ source ./scripts/activate.sh
+        $ cd {path-to-connectedhomeip-examples}
 
 -   Configuration Options
 
         To choose from the different configuration options, run menuconfig
 
-          $ idf make menuconfig
+          $ idf.py menuconfig
 
         Select ESP32 based `Device Type` through `Demo`->`Device Type`.
         The device types that are currently supported include `ESP32-DevKitC` (default),
@@ -52,12 +67,9 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
         `Component config`->`CHIP Device Layer`->`WiFi Station Options`->`Default WiFi SSID` and
         `Default WiFi Password` respectively.
 
-        To use the default configuration options, run the default config
-          $ idf make defconfig
+-   To build the demo application.
 
--   Run make to build the demo application.
-
-          $ idf make
+          $ idf.py build
 
 -   After building the application, to flash it outside of VSCode, connect your
     device via USB. Then run the following command to flash the demo application
@@ -68,7 +80,7 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
     before flashing. For ESP32-DevKitC devices this is labeled in the
     [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
 
-          $ idf make flash monitor ESPPORT=/dev/ttyUSB0
+          $ idf.py flash monitor ESPPORT=/dev/ttyUSB0
 
     Note: Some users might have to install the
     [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
@@ -81,7 +93,7 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).
 
 -   If desired, the monitor can be run again like so:
 
-          $ idf make monitor ESPPORT=/dev/ttyUSB0
+          $ idf.py monitor ESPPORT=/dev/ttyUSB0
 
 ## Using the Echo Server
 
diff --git a/examples/temperature-measurement-app/esp32/main/CMakeLists.txt b/examples/temperature-measurement-app/esp32/main/CMakeLists.txt
new file mode 100644 (file)
index 0000000..99d6225
--- /dev/null
@@ -0,0 +1,42 @@
+#
+#    Copyright (c) 2021 Project CHIP Authors
+#    All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+#
+# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
+# The list of src and include dirs must be in sync with that in temperature-measurement-app/esp32/main/component.mk
+idf_component_register(PRIV_INCLUDE_DIRS 
+                      "${CMAKE_CURRENT_LIST_DIR}"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlio/repo/include"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src"
+                      "${CMAKE_CURRENT_LIST_DIR}/include"
+                      SRC_DIRS
+                      "${CMAKE_CURRENT_LIST_DIR}"
+                      "${CMAKE_CURRENT_LIST_DIR}/gen"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
+                      "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-measurement-server"
+                      PRIV_REQUIRES chip QRCode tft spidriver bt screen-framework)
+
+set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) 
+target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
index 83918a7..095c872 100644 (file)
@@ -68,3 +68,7 @@ CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=1
 CONFIG_NIMBLE_MAX_CONNECTIONS=1
 CONFIG_TCPIP_RECVMBOX_SIZE=16
 CONFIG_TCP_SYNMAXRTX=6
+
+# Product id
+CONFIG_DEVICE_VENDOR_ID=0x235A
+CONFIG_DEVICE_PRODUCT_ID=0x4554
index 45d06b7..fc26502 100644 (file)
@@ -74,9 +74,7 @@ public:
         CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:status
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"" }];
+                NSError * error = [CHIPError errorForCHIPErrorCode:status];
                 callback->mHandler(error, nil);
                 callback->Cancel();
                 delete callback;
index f3dc770..f49f05c 100644 (file)
@@ -679,35 +679,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace ColorControl
 
-namespace ContentLaunch {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchContentCallback();
-            break;
-        }
-        case ZCL_LAUNCH_URL_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchURLCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace ContentLaunch
-
 namespace DoorLock {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -2007,75 +1978,6 @@ void DispatchServerCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace LowPower
 
-namespace MediaPlayback {
-
-void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterFastForwardRequestCallback();
-            break;
-        }
-        case ZCL_NEXT_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterNextRequestCallback();
-            break;
-        }
-        case ZCL_PAUSE_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPauseRequestCallback();
-            break;
-        }
-        case ZCL_PLAY_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPlayRequestCallback();
-            break;
-        }
-        case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPreviousRequestCallback();
-            break;
-        }
-        case ZCL_REWIND_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterRewindRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-            break;
-        }
-        case ZCL_START_OVER_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterStartOverRequestCallback();
-            break;
-        }
-        case ZCL_STOP_REQUEST_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterStopRequestCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace MediaPlayback
-
 namespace NetworkCommissioning {
 
 void DispatchServerCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -2720,9 +2622,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        clusters::ContentLaunch::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
@@ -2741,9 +2640,6 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC
     case ZCL_LOW_POWER_CLUSTER_ID:
         clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        clusters::MediaPlayback::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
-        break;
     case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
         clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
         break;
index 6ca0739..0fd312a 100644 (file)
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Media Playback
+
+// Client attributes
+
+// Server attributes
+#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
+
 // Attribute ids for cluster: Low Power
 
 // Client attributes
 
 // Server attributes
 
+// Attribute ids for cluster: Content Launch
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
 
-// Attribute ids for cluster: Media Playback
-
-// Client attributes
-
-// Server attributes
-#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
-
-// Attribute ids for cluster: Content Launch
-
-// Client attributes
-
-// Server attributes
-
 // Attribute ids for cluster: Group Key Management
 
 // Client attributes
index 9f19be1..ed2bbd6 100644 (file)
@@ -34,7 +34,6 @@ EmberAfStatus emberAfBarrierControlClusterServerCommandParse(EmberAfClusterComma
 EmberAfStatus emberAfBasicClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfContentLaunchClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfDoorLockClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -42,7 +41,6 @@ EmberAfStatus emberAfIasZoneClusterServerCommandParse(EmberAfClusterCommand * cm
 EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfMediaPlaybackClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfNetworkCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);
@@ -112,9 +110,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         case ZCL_COLOR_CONTROL_CLUSTER_ID:
             result = emberAfColorControlClusterServerCommandParse(cmd);
             break;
-        case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-            result = emberAfContentLaunchClusterServerCommandParse(cmd);
-            break;
         case ZCL_DOOR_LOCK_CLUSTER_ID:
             result = emberAfDoorLockClusterServerCommandParse(cmd);
             break;
@@ -133,9 +128,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
         case ZCL_LOW_POWER_CLUSTER_ID:
             result = emberAfLowPowerClusterServerCommandParse(cmd);
             break;
-        case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-            result = emberAfMediaPlaybackClusterServerCommandParse(cmd);
-            break;
         case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
             result = emberAfNetworkCommissioningClusterServerCommandParse(cmd);
             break;
@@ -755,30 +747,6 @@ EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfContentLaunchClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_COMMAND_ID: {
-            wasHandled = emberAfContentLaunchClusterLaunchContentCallback();
-            break;
-        }
-        case ZCL_LAUNCH_URL_COMMAND_ID: {
-            wasHandled = emberAfContentLaunchClusterLaunchURLCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
@@ -1695,62 +1663,6 @@ EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * c
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfMediaPlaybackClusterServerCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_FAST_FORWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterFastForwardRequestCallback();
-            break;
-        }
-        case ZCL_NEXT_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterNextRequestCallback();
-            break;
-        }
-        case ZCL_PAUSE_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPauseRequestCallback();
-            break;
-        }
-        case ZCL_PLAY_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPlayRequestCallback();
-            break;
-        }
-        case ZCL_PREVIOUS_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPreviousRequestCallback();
-            break;
-        }
-        case ZCL_REWIND_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterRewindRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-            break;
-        }
-        case ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-            break;
-        }
-        case ZCL_START_OVER_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterStartOverRequestCallback();
-            break;
-        }
-        case ZCL_STOP_REQUEST_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterStopRequestCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfNetworkCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index d016f61..19505ee 100644 (file)
@@ -41,9 +41,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         emberAfColorControlClusterInitCallback(endpoint);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        emberAfContentLaunchClusterInitCallback(endpoint);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         emberAfDoorLockClusterInitCallback(endpoint);
         break;
@@ -62,9 +59,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_LOW_POWER_CLUSTER_ID:
         emberAfLowPowerClusterInitCallback(endpoint);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        emberAfMediaPlaybackClusterInitCallback(endpoint);
-        break;
     case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
         emberAfNetworkCommissioningClusterInitCallback(endpoint);
         break;
@@ -103,11 +97,6 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfContentLaunchClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -138,11 +127,6 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfMediaPlaybackClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index 3692e0f..f086c1b 100644 (file)
@@ -71,14 +71,6 @@ void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Content Launch Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Door Lock Cluster Init
  *
  * Cluster Init
@@ -127,14 +119,6 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Media Playback Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Network Commissioning Cluster Init
  *
  * Cluster Init
@@ -591,76 +575,6 @@ EmberAfStatus emberAfColorControlClusterServerPreAttributeChangedCallback(chip::
 void emberAfColorControlClusterServerTickCallback(chip::EndpointId endpoint);
 
 //
-// Content Launch Cluster server
-//
-
-/** @brief Content Launch Cluster Server Init
- *
- * Server Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterServerInitCallback(chip::EndpointId endpoint);
-
-/** @brief Content Launch Cluster Server Attribute Changed
- *
- * Server Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfContentLaunchClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Content Launch Cluster Server Manufacturer Specific Attribute Changed
- *
- * Server Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfContentLaunchClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Content Launch Cluster Server Message Sent
- *
- * Server Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfContentLaunchClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Content Launch Cluster Server Pre Attribute Changed
- *
- * server Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfContentLaunchClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Content Launch Cluster Server Tick
- *
- * server Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfContentLaunchClusterServerTickCallback(chip::EndpointId endpoint);
-
-//
 // Door Lock Cluster client
 //
 
@@ -1151,76 +1065,6 @@ EmberAfStatus emberAfLowPowerClusterServerPreAttributeChangedCallback(chip::Endp
 void emberAfLowPowerClusterServerTickCallback(chip::EndpointId endpoint);
 
 //
-// Media Playback Cluster server
-//
-
-/** @brief Media Playback Cluster Server Init
- *
- * Server Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterServerInitCallback(chip::EndpointId endpoint);
-
-/** @brief Media Playback Cluster Server Attribute Changed
- *
- * Server Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfMediaPlaybackClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Media Playback Cluster Server Manufacturer Specific Attribute Changed
- *
- * Server Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfMediaPlaybackClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Media Playback Cluster Server Message Sent
- *
- * Server Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfMediaPlaybackClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Media Playback Cluster Server Pre Attribute Changed
- *
- * server Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfMediaPlaybackClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Media Playback Cluster Server Tick
- *
- * server Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfMediaPlaybackClusterServerTickCallback(chip::EndpointId endpoint);
-
-//
 // Network Commissioning Cluster server
 //
 
@@ -1677,18 +1521,6 @@ bool emberAfColorControlClusterStepSaturationCallback(uint8_t stepMode, uint8_t
 bool emberAfColorControlClusterStopMoveStepCallback(uint8_t optionsMask, uint8_t optionsOverride);
 
 /**
- * @brief Content Launch Cluster LaunchContent Command callback
- */
-
-bool emberAfContentLaunchClusterLaunchContentCallback();
-
-/**
- * @brief Content Launch Cluster LaunchURL Command callback
- */
-
-bool emberAfContentLaunchClusterLaunchURLCallback();
-
-/**
  * @brief Door Lock Cluster LockDoorResponse Command callback
  * @param status
  */
@@ -2033,66 +1865,6 @@ bool emberAfLevelControlClusterStopWithOnOffCallback();
 bool emberAfLowPowerClusterSleepCallback();
 
 /**
- * @brief Media Playback Cluster FastForwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterFastForwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster NextRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterNextRequestCallback();
-
-/**
- * @brief Media Playback Cluster PauseRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPauseRequestCallback();
-
-/**
- * @brief Media Playback Cluster PlayRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPlayRequestCallback();
-
-/**
- * @brief Media Playback Cluster PreviousRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterPreviousRequestCallback();
-
-/**
- * @brief Media Playback Cluster RewindRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterRewindRequestCallback();
-
-/**
- * @brief Media Playback Cluster SkipBackwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterSkipBackwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster SkipForwardRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterSkipForwardRequestCallback();
-
-/**
- * @brief Media Playback Cluster StartOverRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterStartOverRequestCallback();
-
-/**
- * @brief Media Playback Cluster StopRequest Command callback
- */
-
-bool emberAfMediaPlaybackClusterStopRequestCallback();
-
-/**
  * @brief Network Commissioning Cluster AddThreadNetwork Command callback
  * @param operationalDataset
  * @param breadcrumb
index 79d1e15..775f29f 100644 (file)
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for PlayRequest
+ *
+ * Command: PlayRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PauseRequest
+ *
+ * Command: PauseRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
+                                                                                                                                   \
+                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StopRequest
+ *
+ * Command: StopRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StartOverRequest
+ *
+ * Command: StartOverRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
+                                                                                                                                   \
+                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PreviousRequest
+ *
+ * Command: PreviousRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
+                                                                                                                                   \
+                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for NextRequest
+ *
+ * Command: NextRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for RewindRequest
+ *
+ * Command: RewindRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
+                                                                                                                                   \
+                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for FastForwardRequest
+ *
+ * Command: FastForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipForwardRequest
+ *
+ * Command: SkipForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipBackwardRequest
+ *
+ * Command: SkipBackwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
+                                                                                                                                   \
+                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
+
 /** @brief Command description for Sleep
  *
  * Command: Sleep
                                                                                                                                    \
                                                   ZCL_SLEEP_COMMAND_ID, "", );
 
+/** @brief Command description for LaunchContent
+ *
+ * Command: LaunchContent
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
+        emberAfFillExternalBuffer(mask,                                                                                            \
+                                                                                                                                   \
+                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
+
+/** @brief Command description for LaunchURL
+ *
+ * Command: LaunchURL
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
+                                                                                                                                   \
+                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
                                                                                                                                    \
                               ZCL_UNBIND_COMMAND_ID, "uuuu", nodeId, groupId, endpointId, clusterId);
 
-/** @brief Command description for PlayRequest
- *
- * Command: PlayRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PauseRequest
- *
- * Command: PauseRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
-                                                                                                                                   \
-                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StopRequest
- *
- * Command: StopRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StartOverRequest
- *
- * Command: StartOverRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
-                                                                                                                                   \
-                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PreviousRequest
- *
- * Command: PreviousRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
-                                                                                                                                   \
-                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for NextRequest
- *
- * Command: NextRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for RewindRequest
- *
- * Command: RewindRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
-                                                                                                                                   \
-                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for FastForwardRequest
- *
- * Command: FastForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipForwardRequest
- *
- * Command: SkipForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipBackwardRequest
- *
- * Command: SkipBackwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
-                                                                                                                                   \
-                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for LaunchContent
- *
- * Command: LaunchContent
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
-        emberAfFillExternalBuffer(mask,                                                                                            \
-                                                                                                                                   \
-                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
-
-/** @brief Command description for LaunchURL
- *
- * Command: LaunchURL
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
-                                                                                                                                   \
-                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
-
 /** @brief Command description for CommandOne
  *
  * Command: CommandOne
index 9e82931..499adf9 100644 (file)
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Media Playback
+#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0x0506)
+
 // Definitions for cluster: Low Power
 #define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
 
+// Definitions for cluster: Content Launch
+#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0x050A)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
 // Definitions for cluster: Binding
 #define ZCL_BINDING_CLUSTER_ID (0xF000)
 
-// Definitions for cluster: Media Playback
-#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0xF001)
-
-// Definitions for cluster: Content Launch
-#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0xF002)
-
 // Definitions for cluster: Group Key Management
 #define ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID (0xF004)
 
index 864943b..268678a 100644 (file)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Media Playback
+#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
+#define ZCL_PLAYBACK_COMMAND_ID (0x00)
+#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
+#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
+#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
+#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
+#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
+#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
+#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
+#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
+#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
+
 // Commands for cluster: Low Power
 #define ZCL_SLEEP_COMMAND_ID (0x00)
 
+// Commands for cluster: Content Launch
+#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
+#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_BIND_COMMAND_ID (0x00)
 #define ZCL_UNBIND_COMMAND_ID (0x01)
 
-// Commands for cluster: Media Playback
-#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
-#define ZCL_PLAYBACK_COMMAND_ID (0x00)
-#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
-#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
-#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
-#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
-#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
-#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
-#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
-#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
-#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
-
-// Commands for cluster: Content Launch
-#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
-#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
-
 // Commands for cluster: Sample Mfg Specific Cluster
 #define ZCL_COMMAND_ONE_COMMAND_ID (0x00)
 
index 685e685..a7afe9b 100644 (file)
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 112
+#define GENERATED_ATTRIBUTE_COUNT 109
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
         { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* Identify (server): cluster revision */                       \
             { 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },        /* Application Basic (server): product id */           \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */     \
             { 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0,                                                                               \
-              ZAP_LONG_DEFAULTS_INDEX(570) },                               /* Application Basic (server): application id */       \
-            { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },        /* Application Basic (server): catalog vendor id */    \
-            { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) },    /* Application Basic (server): application satus */    \
-            { 0x0000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },        /* Media Playback (server): current state */           \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Media Playback (server): cluster revision */        \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Content Launch (server): cluster revision */        \
+              ZAP_LONG_DEFAULTS_INDEX(570) },                            /* Application Basic (server): application id */          \
+            { 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() },     /* Application Basic (server): catalog vendor id */       \
+            { 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Application Basic (server): application satus */       \
     }
 
 // This is an array of EmberAfCluster structures.
     };
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 19
+#define GENERATED_CLUSTER_COUNT 17
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         { 0x0003,                                                                                                                  \
             {                                                                                                                      \
                 0x050D, ZAP_ATTRIBUTE_INDEX(101), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL                                           \
             }, /* Endpoint: 1, Cluster: Application Basic (server) */                                                              \
-            {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(109), 2, 4, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
-            }, /* Endpoint: 1, Cluster: Media Playback (server) */                                                                 \
-            {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(111), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL                                             \
-            }, /* Endpoint: 1, Cluster: Content Launch (server) */                                                                 \
     }
 
 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 19, 768 },                                                                                         \
+        { ZAP_CLUSTER_INDEX(0), 17, 762 },                                                                                         \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_SINGLETONS_SIZE (254)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (768)
+#define ATTRIBUTE_MAX_SIZE (762)
 
 // Number of fixed endpoints
 #define FIXED_ENDPOINT_COUNT (1)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (158)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (143)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (server): Identify */                                 \
             { 0x0500, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* IAS Zone (server): ZoneStatusChangeNotification */             \
             { 0x0500, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* IAS Zone (server): ZoneEnrollRequest */                        \
             { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Low Power (server): Sleep */                                   \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PlayRequest */                        \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Media Playback (server): Playback */                           \
-            { 0xF001, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PauseRequest */                       \
-            { 0xF001, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): StopRequest */                        \
-            { 0xF001, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): StartOverRequest */                   \
-            { 0xF001, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): PreviousRequest */                    \
-            { 0xF001, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): NextRequest */                        \
-            { 0xF001, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): RewindRequest */                      \
-            { 0xF001, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): FastForwardRequest */                 \
-            { 0xF001, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): SkipForwardRequest */                 \
-            { 0xF001, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (server): SkipBackwardRequest */                \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (server): LaunchContent */                      \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (server): LaunchContentResponse */              \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (server): LaunchURL */                          \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (server): LaunchURLResponse */                  \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index 341731e..01c6617 100644 (file)
@@ -35,7 +35,6 @@
 #define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
-#define EMBER_AF_CONTENT_LAUNCH_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (1)
@@ -43,7 +42,6 @@
 #define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT (1)
-#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1)
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV
 
-// Use this macro to check if the server side of the Content Launch cluster is included
-#define ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH_SERVER
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH
-
 // Use this macro to check if the client side of the Door Lock cluster is included
 #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT
 #define EMBER_AF_PLUGIN_LOW_POWER_SERVER
 #define EMBER_AF_PLUGIN_LOW_POWER
 
-// Use this macro to check if the server side of the Media Playback cluster is included
-#define ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK_SERVER
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK
-
 // Use this macro to check if the server side of the Network Commissioning cluster is included
 #define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER
 #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER
index e3207b7..5cb5a91 100644 (file)
 #define CHIP_PRINTCLUSTER_IAS_WD_CLUSTER
 #endif
 
+#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 1286, "Media Playback" },
+#else
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
+#endif
+
 #if defined(ZCL_USING_LOW_POWER_CLUSTER_SERVER) || defined(ZCL_USING_LOW_POWER_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER { ZCL_LOW_POWER_CLUSTER_ID, 1288, "Low Power" },
 #else
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER
 #endif
 
+#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 1290, "Content Launch" },
+#else
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
+#endif
+
 #if defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER { ZCL_APPLICATION_BASIC_CLUSTER_ID, 1293, "Application Basic" },
 #else
 #define CHIP_PRINTCLUSTER_BINDING_CLUSTER
 #endif
 
-#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 61441, "Media Playback" },
-#else
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
-#endif
-
-#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 61442, "Content Launch" },
-#else
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
-#endif
-
 #if defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER) || defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER { ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID, 61444, "Group Key Management" },
 #else
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
     CHIP_PRINTCLUSTER_DIAGNOSTICS_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_ZLL_COMMISSIONING_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_BINDING_CLUSTER                                                                                              \
-    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
-    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER                                                                                 \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER                                                                                  \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER_2                                                                                \
index 2306aef..3db71e2 100644 (file)
@@ -2,13 +2,18 @@ pip-tools
 virtualenv
 
 # esp-idf
-pyelftools>=0.22
+setuptools>=21
 click>=5.0
 pyserial>=3.0
 future>=0.15.2
-cryptography>=3.2
+cryptography>=2.1.4
 pyparsing>=2.0.3,<2.4.0
 pyelftools>=0.22
+gdbgui==0.13.2.0
+pygdbmi<=0.9.0.2
+reedsolo>=1.5.3,<=1.5.4
+bitstring>=3.1.6
+ecdsa>=0.16.0
 
 # cirque tests
 requests>=2.24.0
@@ -35,8 +40,8 @@ psutil >= 5.7.3
 
 # pigweed
 ipython
-appnope; sys_platform == 'darwin'
-appdirs; sys_platform == 'darwin'
+appnope
+appdirs
 coloredlogs
 watchdog
 protobuf
index cb0cd5d..b994900 100644 (file)
@@ -4,16 +4,20 @@
 #
 #    pip-compile requirements.in
 #
-appdirs==1.4.4 ; sys_platform == "darwin"
+appdirs==1.4.4
     # via
     #   -r requirements.in
     #   virtualenv
-appnope==0.1.2 ; sys_platform == "darwin"
-    # via
-    #   -r requirements.in
-    #   ipython
+appnope==0.1.2
+    # via -r requirements.in
 backcall==0.2.0
     # via ipython
+bidict==0.21.2
+    # via python-socketio
+bitstring==3.1.7
+    # via -r requirements.in
+brotli==1.0.9
+    # via flask-compress
 certifi==2020.12.5
     # via requests
 cffi==1.14.5
@@ -23,6 +27,7 @@ chardet==4.0.0
 click==7.1.2
     # via
     #   -r requirements.in
+    #   flask
     #   pip-tools
 colorama==0.4.4
     # via west
@@ -38,12 +43,29 @@ distlib==0.3.1
     # via virtualenv
 docopt==0.6.2
     # via pykwalify
+ecdsa==0.16.1
+    # via -r requirements.in
 filelock==3.0.12
     # via virtualenv
+flask-compress==1.9.0
+    # via gdbgui
+flask-socketio==2.9.6
+    # via gdbgui
+flask==0.12.5
+    # via
+    #   flask-compress
+    #   flask-socketio
+    #   gdbgui
 future==0.18.2
     # via
     #   -r requirements.in
     #   mobly
+gdbgui==0.13.2.0
+    # via -r requirements.in
+gevent==1.5.0
+    # via gdbgui
+greenlet==1.0.0
+    # via gevent
 humanfriendly==9.1
     # via coloredlogs
 idna==2.10
@@ -54,31 +76,39 @@ ipython-genutils==0.2.0
     # via traitlets
 ipython==7.21.0
     # via -r requirements.in
+itsdangerous==1.1.0
+    # via flask
 jedi==0.18.0
     # via ipython
+jinja2==2.11.3
+    # via flask
 lockfile==0.12.2
     # via -r requirements.in
+markupsafe==1.1.1
+    # via jinja2
 mobly==1.10.1
     # via -r requirements.in
 packaging==20.9
     # via west
 parso==0.8.1
     # via jedi
+pep517==0.10.0
+    # via pip-tools
 pexpect==4.8.0
     # via ipython
 pgi==0.0.11.2 ; sys_platform == "linux"
     # via -r requirements.in
 pickleshare==0.7.5
     # via ipython
-pip-tools==5.5.0
+pip-tools==6.0.1
     # via -r requirements.in
 portpicker==1.3.1
     # via
     #   -r requirements.in
     #   mobly
-prompt-toolkit==3.0.16
+prompt-toolkit==3.0.17
     # via ipython
-protobuf==3.15.5
+protobuf==3.15.6
     # via -r requirements.in
 psutil==5.8.0
     # via
@@ -90,8 +120,14 @@ pycparser==2.20
     # via cffi
 pyelftools==0.27
     # via -r requirements.in
-pygments==2.8.0
-    # via ipython
+pygdbmi==0.9.0.2
+    # via
+    #   -r requirements.in
+    #   gdbgui
+pygments==2.8.1
+    # via
+    #   gdbgui
+    #   ipython
 pykwalify==1.8.0
     # via west
 pyobjc-core==7.1 ; sys_platform == "darwin"
@@ -115,10 +151,16 @@ pyserial==3.5
     #   mobly
 python-dateutil==2.8.1
     # via pykwalify
+python-engineio==4.0.1
+    # via python-socketio
+python-socketio==5.1.0
+    # via flask-socketio
 pyyaml==5.4.1
     # via
     #   mobly
     #   west
+reedsolo==1.5.4
+    # via -r requirements.in
 requests==2.25.1
     # via -r requirements.in
 ruamel.yaml.clib==0.2.2
@@ -127,22 +169,27 @@ ruamel.yaml==0.16.13
     # via pykwalify
 six==1.15.0
     # via
+    #   ecdsa
     #   protobuf
     #   python-dateutil
     #   virtualenv
 timeout-decorator==0.5.0
     # via mobly
+toml==0.10.2
+    # via pep517
 traitlets==5.0.5
     # via ipython
-urllib3==1.26.3
+urllib3==1.26.4
     # via requests
-virtualenv==20.4.2
+virtualenv==20.4.3
     # via -r requirements.in
 watchdog==2.0.2
     # via -r requirements.in
 wcwidth==0.2.5
     # via prompt-toolkit
-west==0.9.0
+werkzeug==0.16.1
+    # via flask
+west==0.10.1
     # via -r requirements.in
 wheel==0.36.2
     # via -r requirements.in
index c2e985a..6e1acf4 100644 (file)
@@ -48,6 +48,7 @@ if (chip_build_tests) {
       "${chip_root}/src/lib/support/tests",
       "${chip_root}/src/messaging/tests",
       "${chip_root}/src/protocols/bdx/tests",
+      "${chip_root}/src/protocols/secure_channel/tests",
       "${chip_root}/src/setup_payload/tests",
       "${chip_root}/src/system/tests",
       "${chip_root}/src/transport/raw/tests",
index efe089a..f068ebb 100644 (file)
@@ -221,7 +221,7 @@ exit:
     return err;
 }
 
-CHIP_ERROR Command::AddStatusCode(const uint16_t aGeneralCode, const uint32_t aProtocolId, const uint16_t aProtocolCode,
+CHIP_ERROR Command::AddStatusCode(const uint16_t aGeneralCode, Protocols::Id aProtocolId, const uint16_t aProtocolCode,
                                   const chip::ClusterId aClusterId)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
@@ -230,7 +230,8 @@ CHIP_ERROR Command::AddStatusCode(const uint16_t aGeneralCode, const uint32_t aP
     err = statusElementBuilder.Init(mInvokeCommandBuilder.GetWriter());
     SuccessOrExit(err);
 
-    statusElementBuilder.EncodeStatusElement(aGeneralCode, aProtocolId, aProtocolCode, aProtocolCode).EndOfStatusElement();
+    statusElementBuilder.EncodeStatusElement(aGeneralCode, aProtocolId.ToFullyQualifiedSpecForm(), aProtocolCode, aProtocolCode)
+        .EndOfStatusElement();
     err = statusElementBuilder.GetError();
 
     MoveToState(CommandState::AddCommand);
index 5103e05..caf0569 100644 (file)
@@ -119,7 +119,7 @@ public:
     CHIP_ERROR AddCommand(chip::EndpointId aEndpintId, chip::GroupId aGroupId, chip::ClusterId aClusterId,
                           chip::CommandId aCommandId, BitFlags<CommandPathFlags> Flags);
     CHIP_ERROR AddCommand(CommandParams & aCommandParams);
-    CHIP_ERROR AddStatusCode(const uint16_t aGeneralCode, const uint32_t aProtocolId, const uint16_t aProtocolCode,
+    CHIP_ERROR AddStatusCode(const uint16_t aGeneralCode, Protocols::Id aProtocolId, const uint16_t aProtocolCode,
                              const chip::ClusterId aClusterId);
 
     /**
index ff5e248..e7114d4 100644 (file)
@@ -28,7 +28,6 @@
 #include "InteractionModelEngine.h"
 
 #include <protocols/secure_channel/Constants.h>
-#include <support/ReturnMacros.h>
 
 using GeneralStatusCode = chip::Protocols::SecureChannel::GeneralStatusCode;
 
@@ -94,7 +93,7 @@ CHIP_ERROR CommandHandler::ProcessCommandDataElement(CommandDataElement::Parser
         // Empty Command, Add status code in invoke command response, notify cluster handler to hand it further.
         err = CHIP_NO_ERROR;
         ChipLogDetail(DataManagement, "Add Status code for empty command, cluster Id is %d", clusterId);
-        AddStatusCode(static_cast<uint16_t>(GeneralStatusCode::kSuccess), Protocols::kProtocol_SecureChannel,
+        AddStatusCode(static_cast<uint16_t>(GeneralStatusCode::kSuccess), Protocols::SecureChannel::Id,
                       Protocols::SecureChannel::kProtocolCodeSuccess, clusterId);
     }
     else if (CHIP_NO_ERROR == err)
index 5434a2d..b19401f 100644 (file)
@@ -147,7 +147,7 @@ CHIP_ERROR CommandSender::ProcessCommandDataElement(CommandDataElement::Parser &
         {
             err = CHIP_NO_ERROR;
             ChipLogDetail(DataManagement, "Add Status code for empty command, cluster Id is %d", clusterId);
-            AddStatusCode(static_cast<uint16_t>(GeneralStatusCode::kSuccess), Protocols::kProtocol_SecureChannel,
+            AddStatusCode(static_cast<uint16_t>(GeneralStatusCode::kSuccess), Protocols::SecureChannel::Id,
                           Protocols::SecureChannel::kProtocolCodeSuccess, clusterId);
         }
         // TODO(#4503): Should call callbacks of cluster that sends the command.
index 65fdcce..3226c8d 100644 (file)
@@ -47,7 +47,7 @@ CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeM
     mpExchangeMgr = apExchangeMgr;
     mpDelegate    = apDelegate;
 
-    err = mpExchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(Protocols::kProtocol_InteractionModel, this);
+    err = mpExchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(Protocols::InteractionModel::Id, this);
     SuccessOrExit(err);
 
 exit:
index 15e563c..1f252a6 100644 (file)
@@ -33,7 +33,6 @@
 | Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
-| ContentLaunch                                                       | 0xF002 |
 | DoorLock                                                            | 0x0101 |
 | GeneralCommissioning                                                | 0x0030 |
 | GroupKeyManagement                                                  | 0xF004 |
@@ -42,7 +41,6 @@
 | Identify                                                            | 0x0003 |
 | LevelControl                                                        | 0x0008 |
 | LowPower                                                            | 0x0508 |
-| MediaPlayback                                                       | 0xF001 |
 | NetworkCommissioning                                                | 0x0031 |
 | OnOff                                                               | 0x0006 |
 | Scenes                                                              | 0x0005 |
@@ -1065,43 +1063,6 @@ chip::System::PacketBufferHandle encodeColorControlClusterReadClusterRevisionAtt
                                                                                        chip::EndpointId destinationEndpoint);
 
 /*----------------------------------------------------------------------------*\
-| Cluster ContentLaunch                                               | 0xF002 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * LaunchContent                                                     |   0x00 |
-| * LaunchURL                                                         |   0x01 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/**
- * @brief
- *    Encode an LaunchContent command for Content Launch server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeContentLaunchClusterLaunchContentCommand(uint8_t seqNum,
-                                                                                chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an LaunchURL command for Content Launch server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeContentLaunchClusterLaunchURLCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode a Content Launch server discover command into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeContentLaunchClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode a Content Launch server read command for the cluster revision attribute into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeContentLaunchClusterReadClusterRevisionAttribute(uint8_t seqNum,
-                                                                                        chip::EndpointId destinationEndpoint);
-
-/*----------------------------------------------------------------------------*\
 | Cluster DoorLock                                                    | 0x0101 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
@@ -1791,113 +1752,6 @@ chip::System::PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribu
                                                                                    chip::EndpointId destinationEndpoint);
 
 /*----------------------------------------------------------------------------*\
-| Cluster MediaPlayback                                               | 0xF001 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * FastForwardRequest                                                |   0x07 |
-| * NextRequest                                                       |   0x05 |
-| * PauseRequest                                                      |   0x01 |
-| * PlayRequest                                                       |   0x00 |
-| * PreviousRequest                                                   |   0x04 |
-| * RewindRequest                                                     |   0x06 |
-| * SkipBackwardRequest                                               |   0x09 |
-| * SkipForwardRequest                                                |   0x08 |
-| * StartOverRequest                                                  |   0x03 |
-| * StopRequest                                                       |   0x02 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * CurrentState                                                      | 0x0000 |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/**
- * @brief
- *    Encode an FastForwardRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterFastForwardRequestCommand(uint8_t seqNum,
-                                                                                     chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an NextRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterNextRequestCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an PauseRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterPauseRequestCommand(uint8_t seqNum,
-                                                                               chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an PlayRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterPlayRequestCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an PreviousRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterPreviousRequestCommand(uint8_t seqNum,
-                                                                                  chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an RewindRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterRewindRequestCommand(uint8_t seqNum,
-                                                                                chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an SkipBackwardRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterSkipBackwardRequestCommand(uint8_t seqNum,
-                                                                                      chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an SkipForwardRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterSkipForwardRequestCommand(uint8_t seqNum,
-                                                                                     chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an StartOverRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterStartOverRequestCommand(uint8_t seqNum,
-                                                                                   chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode an StopRequest command for Media Playback server into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterStopRequestCommand(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode a Media Playback server discover command into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterDiscoverAttributes(uint8_t seqNum, chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode a Media Playback server read command for the current state attribute into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterReadCurrentStateAttribute(uint8_t seqNum,
-                                                                                     chip::EndpointId destinationEndpoint);
-
-/**
- * @brief
- *    Encode a Media Playback server read command for the cluster revision attribute into buffer including the APS frame
- */
-chip::System::PacketBufferHandle encodeMediaPlaybackClusterReadClusterRevisionAttribute(uint8_t seqNum,
-                                                                                        chip::EndpointId destinationEndpoint);
-
-/*----------------------------------------------------------------------------*\
 | Cluster NetworkCommissioning                                        | 0x0031 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
index 5892a57..8a305b1 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <app/util/af.h>
 
+#include <app/reporting/reporting.h>
 #include <app/util/af-event.h>
 #include <app/util/attribute-storage.h>
 #include <assert.h>
 #include "gen/attribute-type.h"
 #include "gen/cluster-id.h"
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
-#include <app/reporting/reporting.h>
-#endif
-
 using namespace chip;
 
 #define COLOR_TEMP_CONTROL emberAfPluginColorControlServerTempTransitionEventControl
index 7dbf861..7ba20de 100644 (file)
@@ -50,9 +50,7 @@
 #include "gen/cluster-id.h"
 #include "gen/command-id.h"
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
 #include <app/reporting/reporting.h>
-#endif
 
 #ifdef EMBER_AF_PLUGIN_SCENES
 #include <app/clusters/scenes/scenes.h>
index b2bde70..2bde913 100644 (file)
@@ -31,7 +31,6 @@
 #include <util/af.h>
 
 #include <lib/support/CodeUtils.h>
-#include <lib/support/ReturnMacros.h>
 #include <lib/support/SafeInt.h>
 #include <lib/support/Span.h>
 #include <lib/support/logging/CHIPLogging.h>
index 4c73acd..ade2784 100644 (file)
@@ -48,9 +48,7 @@
 #include "gen/cluster-id.h"
 #include "gen/command-id.h"
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
 #include <app/reporting/reporting.h>
-#endif
 
 #ifdef EMBER_AF_PLUGIN_SCENES
 #include <app/clusters/scenes/scenes.h>
index ee8a3c0..bba2fef 100644 (file)
@@ -104,7 +104,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 | Basic                                                               | 0x0028 |
 | Binding                                                             | 0xF000 |
 | ColorControl                                                        | 0x0300 |
-| ContentLaunch                                                       | 0xF002 |
 | DoorLock                                                            | 0x0101 |
 | GeneralCommissioning                                                | 0x0030 |
 | GroupKeyManagement                                                  | 0xF004 |
@@ -113,7 +112,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 | Identify                                                            | 0x0003 |
 | LevelControl                                                        | 0x0008 |
 | LowPower                                                            | 0x0508 |
-| MediaPlayback                                                       | 0xF001 |
 | NetworkCommissioning                                                | 0x0031 |
 | OnOff                                                               | 0x0006 |
 | Scenes                                                              | 0x0005 |
@@ -175,10 +173,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 #define ZCL_STEP_SATURATION_COMMAND_ID (0x05)
 #define ZCL_STOP_MOVE_STEP_COMMAND_ID (0x47)
 
-#define CONTENT_LAUNCH_CLUSTER_ID 0xF002
-#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
-
 #define DOOR_LOCK_CLUSTER_ID 0x0101
 #define ZCL_CLEAR_ALL_PINS_COMMAND_ID (0x08)
 #define ZCL_CLEAR_ALL_RFIDS_COMMAND_ID (0x19)
@@ -238,18 +232,6 @@ uint16_t encodeApsFrame(uint8_t * buffer, uint16_t buf_length, EmberApsFrame * a
 #define LOW_POWER_CLUSTER_ID 0x0508
 #define ZCL_SLEEP_COMMAND_ID (0x00)
 
-#define MEDIA_PLAYBACK_CLUSTER_ID 0xF001
-#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
-#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
-#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
-#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
-#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
-#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
-#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
-#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
-#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
-#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
-
 #define NETWORK_COMMISSIONING_CLUSTER_ID 0x0031
 #define ZCL_ADD_THREAD_NETWORK_COMMAND_ID (0x06)
 #define ZCL_ADD_WI_FI_NETWORK_COMMAND_ID (0x02)
@@ -1874,54 +1856,6 @@ PacketBufferHandle encodeColorControlClusterReadClusterRevisionAttribute(uint8_t
 }
 
 /*----------------------------------------------------------------------------*\
-| Cluster ContentLaunch                                               | 0xF002 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * LaunchContent                                                     |   0x00 |
-| * LaunchURL                                                         |   0x01 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/*
- * Command LaunchContent
- */
-PacketBufferHandle encodeContentLaunchClusterLaunchContentCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("LaunchContent", CONTENT_LAUNCH_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_LAUNCH_CONTENT_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command LaunchURL
- */
-PacketBufferHandle encodeContentLaunchClusterLaunchURLCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("LaunchURL", CONTENT_LAUNCH_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_LAUNCH_URL_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-PacketBufferHandle encodeContentLaunchClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("DiscoverContentLaunchAttributes", CONTENT_LAUNCH_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
-    COMMAND_FOOTER();
-}
-
-/*
- * Attribute ClusterRevision
- */
-PacketBufferHandle encodeContentLaunchClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("ReadContentLaunchClusterRevision", CONTENT_LAUNCH_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
-    COMMAND_FOOTER();
-}
-
-/*----------------------------------------------------------------------------*\
 | Cluster DoorLock                                                    | 0x0101 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
@@ -3086,153 +3020,6 @@ PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribute(uint8_t seq
 }
 
 /*----------------------------------------------------------------------------*\
-| Cluster MediaPlayback                                               | 0xF001 |
-|------------------------------------------------------------------------------|
-| Commands:                                                           |        |
-| * FastForwardRequest                                                |   0x07 |
-| * NextRequest                                                       |   0x05 |
-| * PauseRequest                                                      |   0x01 |
-| * PlayRequest                                                       |   0x00 |
-| * PreviousRequest                                                   |   0x04 |
-| * RewindRequest                                                     |   0x06 |
-| * SkipBackwardRequest                                               |   0x09 |
-| * SkipForwardRequest                                                |   0x08 |
-| * StartOverRequest                                                  |   0x03 |
-| * StopRequest                                                       |   0x02 |
-|------------------------------------------------------------------------------|
-| Attributes:                                                         |        |
-| * CurrentState                                                      | 0x0000 |
-| * ClusterRevision                                                   | 0xFFFD |
-\*----------------------------------------------------------------------------*/
-
-/*
- * Command FastForwardRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterFastForwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("FastForwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_FAST_FORWARD_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command NextRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterNextRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("NextRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_NEXT_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command PauseRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterPauseRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("PauseRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PAUSE_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command PlayRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterPlayRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("PlayRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PLAY_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command PreviousRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterPreviousRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("PreviousRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_PREVIOUS_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command RewindRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterRewindRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("RewindRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_REWIND_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command SkipBackwardRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterSkipBackwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("SkipBackwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command SkipForwardRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterSkipForwardRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("SkipForwardRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command StartOverRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterStartOverRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("StartOverRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_START_OVER_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-/*
- * Command StopRequest
- */
-PacketBufferHandle encodeMediaPlaybackClusterStopRequestCommand(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("StopRequest", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlClusterSpecificCommand).Put8(seqNum).Put8(ZCL_STOP_REQUEST_COMMAND_ID);
-    COMMAND_FOOTER();
-}
-
-PacketBufferHandle encodeMediaPlaybackClusterDiscoverAttributes(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("DiscoverMediaPlaybackAttributes", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID).Put16(0x0000).Put8(0xFF);
-    COMMAND_FOOTER();
-}
-
-/*
- * Attribute CurrentState
- */
-PacketBufferHandle encodeMediaPlaybackClusterReadCurrentStateAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("ReadMediaPlaybackCurrentState", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0x0000);
-    COMMAND_FOOTER();
-}
-
-/*
- * Attribute ClusterRevision
- */
-PacketBufferHandle encodeMediaPlaybackClusterReadClusterRevisionAttribute(uint8_t seqNum, EndpointId destinationEndpoint)
-{
-    COMMAND_HEADER("ReadMediaPlaybackClusterRevision", MEDIA_PLAYBACK_CLUSTER_ID);
-    buf.Put8(kFrameControlGlobalCommand).Put8(seqNum).Put8(ZCL_READ_ATTRIBUTES_COMMAND_ID).Put16(0xFFFD);
-    COMMAND_FOOTER();
-}
-
-/*----------------------------------------------------------------------------*\
 | Cluster NetworkCommissioning                                        | 0x0031 |
 |------------------------------------------------------------------------------|
 | Commands:                                                           |        |
index 66a941e..28c752f 100644 (file)
@@ -132,14 +132,20 @@ static uint32_t computeStringHash(uint8_t * data, uint8_t length)
 }
 
 #ifdef EZSP_HOST
+#if REPORT_TABLE_SIZE != 0
 static EmberAfPluginReportingEntry table[REPORT_TABLE_SIZE];
+#endif
 void emAfPluginReportingGetEntry(uint8_t index, EmberAfPluginReportingEntry * result)
 {
+#if REPORT_TABLE_SIZE != 0
     memmove(result, &table[index], sizeof(EmberAfPluginReportingEntry));
+#endif
 }
 void emAfPluginReportingSetEntry(uint8_t index, EmberAfPluginReportingEntry * value)
 {
+#if REPORT_TABLE_SIZE != 0
     memmove(&table[index], value, sizeof(EmberAfPluginReportingEntry));
+#endif
 }
 #else
 void emAfPluginReportingGetEntry(uint8_t index, EmberAfPluginReportingEntry * result)
index 59984bd..496fc83 100644 (file)
@@ -23,7 +23,6 @@
 #include <mdns/Advertiser.h>
 #include <platform/CHIPDeviceLayer.h>
 #include <platform/ConfigurationManager.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 #include <transport/AdminPairingTable.h>
 #include <transport/PASESession.h>
index 2e7fd5a..f6eda70 100644 (file)
@@ -20,7 +20,6 @@
 #include <app/server/SessionManager.h>
 #include <core/CHIPError.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/SecureSessionMgr.h>
 #include <transport/StorablePeerConnection.h>
index b3c4936..8d8209f 100644 (file)
@@ -20,7 +20,6 @@
 #include <app/server/AppDelegate.h>
 #include <core/CHIPPersistentStorageDelegate.h>
 #include <platform/CHIPDeviceLayer.h>
-#include <support/ReturnMacros.h>
 #include <transport/RendezvousSession.h>
 
 namespace chip {
index b34bd60..48c7176 100644 (file)
@@ -34,7 +34,6 @@
 #include <setup_payload/SetupPayload.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 #include <sys/param.h>
 #include <system/SystemPacketBuffer.h>
@@ -78,12 +77,6 @@ class ServerStorageDelegate : public PersistentStorageDelegate
         chipDie();
     }
 
-    void AsyncGetKeyValue(const char * key) override
-    {
-        ChipLogError(AppServer, "ServerStorageDelegate does not support async operations");
-        chipDie();
-    }
-
     void AsyncSetKeyValue(const char * key, const char * value) override
     {
         ChipLogError(AppServer, "ServerStorageDelegate does not support async operations");
@@ -338,7 +331,7 @@ public:
 
         // TODO: This code is temporary, and must be updated to use the Cluster API.
         // Issue: https://github.com/project-chip/connectedhomeip/issues/4725
-        if (payloadHeader.GetProtocolID() == chip::Protocols::kProtocol_ServiceProvisioning)
+        if (payloadHeader.HasProtocol(chip::Protocols::ServiceProvisioning::Id))
         {
             CHIP_ERROR err = CHIP_NO_ERROR;
             uint32_t timeout;
@@ -348,7 +341,7 @@ public:
             ChipLogProgress(AppServer, "Received service provisioning message. Treating it as OpenPairingWindow request");
             chip::System::PacketBufferTLVReader reader;
             reader.Init(std::move(buffer));
-            reader.ImplicitProfileId = chip::Protocols::kProtocol_ServiceProvisioning;
+            reader.ImplicitProfileId = chip::Protocols::ServiceProvisioning::Id.ToTLVProfileId();
 
             SuccessOrExit(reader.Next(kTLVType_UnsignedInteger, TLV::ProfileTag(reader.ImplicitProfileId, 1)));
             SuccessOrExit(reader.Get(timeout));
index 9c1bc2b..2ab066e 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <core/CHIPCore.h>
 #include <inttypes.h>
-#include <support/ReturnMacros.h>
 
 namespace {
 struct ResponseCallbackInfo
index 884ea53..b8d6ed9 100644 (file)
@@ -50,9 +50,7 @@
 #include "app/util/common.h"
 #include "gen/callback.h"
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
 #include <app/reporting/reporting.h>
-#endif // EMBER_AF_PLUGIN_REPORTING
 
 using namespace chip;
 
@@ -602,9 +600,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu
         // Function itself will weed out tokens that are not tokenized.
         emAfSaveAttributeToToken(data, endpoint, cluster, metadata);
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
         emberAfReportingAttributeChangeCallback(endpoint, cluster, attributeID, mask, manufacturerCode, dataType, data);
-#endif // EMBER_AF_PLUGIN_REPORTING
 
         // Post write attribute callback for all attributes changes, regardless
         // of cluster.
index 69ec0a4..9b2f43c 100644 (file)
 #include "af.h"
 
 #include <app/clusters/ias-zone-client/ias-zone-client.h>
-#include <app/util/common.h>
-
-#ifdef EMBER_AF_PLUGIN_REPORTING
 #include <app/reporting/reporting.h>
-#endif // EMBER_AF_PLUGIN_REPORTING
+#include <app/util/common.h>
 
 #include "gen/attribute-id.h"
 #include "gen/attribute-type.h"
@@ -479,7 +476,6 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd)
         return true;
     }
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
     case ZCL_CONFIGURE_REPORTING_COMMAND_ID:
         if (emberAfConfigureReportingCommandCallback(cmd))
         {
@@ -493,7 +489,6 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd)
             return true;
         }
         break;
-#endif // EMBER_AF_PLUGIN_REPORTING
 
     // ([attribute id:2] [status:1] [type:0/1] [value:0/V])+
     case ZCL_READ_ATTRIBUTES_RESPONSE_COMMAND_ID:
@@ -579,7 +574,6 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd)
         }
         return true;
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
     // ([status:1] [direction:1] [attribute id:2])+
     case ZCL_CONFIGURE_REPORTING_RESPONSE_COMMAND_ID:
         if (!emberAfConfigureReportingResponseCallback(clusterId, message + msgIndex, static_cast<uint16_t>(msgLen - msgIndex)))
@@ -598,7 +592,6 @@ bool emAfProcessGlobalCommand(EmberAfClusterCommand * cmd)
             emberAfSendDefaultResponse(cmd, EMBER_ZCL_STATUS_SUCCESS);
         }
         return true;
-#endif // EMBER_AF_PLUGIN_REPORTING
 
     // ([attribute id:2] [type:1] [data:V])+
     case ZCL_REPORT_ATTRIBUTES_COMMAND_ID:
index 4ee4aa1..105babc 100644 (file)
@@ -44,6 +44,7 @@
 #include "af-main.h"
 #include "af.h"
 #include "app/util/common.h"
+#include <app/reporting/reporting.h>
 
 #include "gen/attribute-id.h"
 #include "gen/attribute-type.h"
 #include <app/clusters/groups-server/groups-server.h>
 #endif // EMBER_AF_PLUGIN_GROUPS_SERVER
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
-#include <app/reporting/reporting.h>
-#endif // EMBER_AF_PLUGIN_REPORTING
-
 using namespace chip;
 
 // Function for Compatibility
@@ -289,9 +286,9 @@ void emberAfInit(void)
     // initialize event management system
     emAfInitEvents();
 
-#ifdef EMBER_AF_PLUGIN_REPORTING
+    // Initialize the reporting plugin
     emberAfPluginReportingInitCallback();
-#endif
+
 #ifdef EMBER_AF_PLUGIN_TEMPERATURE_MEASUREMENT_SERVER
     emberAfPluginTemperatureMeasurementServerInitCallback();
 #endif
@@ -333,12 +330,10 @@ void emberAfStackDown(void)
         // && emberNetworkState() == EMBER_NO_NETWORK
     )
     {
-#ifdef EMBER_AF_PLUGIN_REPORTING
         // the report table should be cleared when the stack comes down.
         // going to a new network means new report devices should be discovered.
         // if the table isnt cleared the device keeps trying to send messages.
         emberAfClearReportTableCallback();
-#endif // EMBER_AF_PLUGIN_REPORTING
     }
 
     emberAfRegistrationAbortCallback();
index 7ba7671..5feb5d8 100644 (file)
@@ -58,7 +58,7 @@ public:
         CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError* error = [NSError errorWithDomain:CHIPErrorDomain code:status userInfo:@{NSLocalizedDescriptionKey:@""}];
+                NSError * error = [CHIPError errorForCHIPErrorCode:status];
                 callback->mHandler(error, nil);
                 callback->Cancel();
                 delete callback;
@@ -412,7 +412,7 @@ private:
         {
             return nil;
         }
-    
+
         CHIP_ERROR err = cppCluster->Associate([device internalDevice], endpoint);
         if (err != CHIP_NO_ERROR) {
             return nil;
index f8a74e3..4b26f87 100644 (file)
 #define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_ ## x
 #define ZAP_REPORT_DIRECTION(x) ZRD(x)
 
-{{#if (endpoint_reporting_config_default_count)}}
-// Use this macro to check if Reporting plugin is included
-#define EMBER_AF_PLUGIN_REPORTING
 // User options for plugin Reporting
 #define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE ({{endpoint_reporting_config_default_count}})
 #define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
-{{/if}}
 
 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE ({{endpoint_reporting_config_default_count}})
 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS {{endpoint_reporting_config_defaults}}
index 62126b5..f5e9e7b 100644 (file)
@@ -5,7 +5,6 @@
 
 #include <app/chip-zcl-zpro-codec-api.h>
 #include <lib/support/Span.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace Controller {
index a886acf..e4953de 100644 (file)
@@ -5,7 +5,6 @@
 #include <app/CommandSender.h>
 #include <app/InteractionModelEngine.h>
 #include <lib/support/Span.h>
-#include <support/ReturnMacros.h>
 
 #include <controller/CHIPClusters.h>
 #include <controller/CHIPDevice.h>
index 6400f13..6f505e4 100644 (file)
@@ -19,7 +19,7 @@ limitations under the License.
   <cluster>
     <domain>General</domain>
     <name>Content Launch</name>
-    <code>0xF002</code>
+    <code>0x050a</code>
     <define>CONTENT_LAUNCH_CLUSTER</define>
     <client init="false" tick="false">true</client>
     <server init="false" tick="false">true</server>
index 538332d..0c57f21 100644 (file)
@@ -19,7 +19,7 @@ limitations under the License.
   <cluster>
     <domain>General</domain>
     <name>Media Playback</name>
-    <code>0xF001</code>
+    <code>0x0506</code>
     <define>MEDIA_PLAYBACK_CLUSTER</define>
     <client init="false" tick="false">true</client>
     <server init="false" tick="false">true</server>
index aaf0d52..c942f41 100644 (file)
@@ -632,12 +632,12 @@ void BLEEndPoint::QueueTx(PacketBufferHandle && data, PacketType_t type)
     if (mSendQueue.IsNull())
     {
         mSendQueue = std::move(data);
-        ChipLogDebugBleEndPoint(Ble, "%s: Set data as new mSendQueue %p, type %d", __FUNCTION__, mSendQueue, type);
+        ChipLogDebugBleEndPoint(Ble, "%s: Set data as new mSendQueue %p, type %d", __FUNCTION__, mSendQueue->Start(), type);
     }
     else
     {
         mSendQueue->AddToEnd(std::move(data));
-        ChipLogDebugBleEndPoint(Ble, "%s: Append data to mSendQueue %p, type %d", __FUNCTION__, mSendQueue, type);
+        ChipLogDebugBleEndPoint(Ble, "%s: Append data to mSendQueue %p, type %d", __FUNCTION__, mSendQueue->Start(), type);
     }
 
     QueueTxUnlock();
@@ -993,7 +993,7 @@ BLE_ERROR BLEEndPoint::DriveSending()
     {
 #ifdef CHIP_BLE_END_POINT_DEBUG_LOGGING_ENABLED
         if (mRemoteReceiveWindowSize <= BTP_WINDOW_NO_ACK_SEND_THRESHOLD &&
-            !mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning) && mAckToSend == NULL)
+            !mTimerStateFlags.Has(TimerStateFlag::kSendAckTimerRunning) && mAckToSend.IsNull())
         {
             ChipLogDebugBleEndPoint(Ble, "NO SEND: receive window almost closed, and no ack to send");
         }
index 7be1eb8..a2bac1c 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <app/chip-zcl-zpro-codec-api.h>
 #include <lib/support/Span.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace Controller {
@@ -1655,83 +1654,6 @@ CHIP_ERROR ColorControlCluster::ReadAttributeClusterRevision(Callback::Cancelabl
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
 }
 
-// ContentLaunch Cluster Commands
-CHIP_ERROR ContentLaunchCluster::LaunchContent(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kLaunchContentCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeContentLaunchClusterLaunchContentCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR ContentLaunchCluster::LaunchURL(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kLaunchURLCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeContentLaunchClusterLaunchURLCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-// ContentLaunch Cluster Attributes
-CHIP_ERROR ContentLaunchCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback,
-                                                    Callback::Cancelable * onFailureCallback)
-{
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeContentLaunchClusterDiscoverAttributes(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-}
-CHIP_ERROR ContentLaunchCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback,
-                                                              Callback::Cancelable * onFailureCallback)
-{
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeContentLaunchClusterReadClusterRevisionAttribute(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-}
-
 // DoorLock Cluster Commands
 CHIP_ERROR DoorLockCluster::ClearAllPins(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
 {
@@ -3553,335 +3475,6 @@ CHIP_ERROR LowPowerCluster::ReadAttributeClusterRevision(Callback::Cancelable *
     return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
 }
 
-// MediaPlayback Cluster Commands
-CHIP_ERROR MediaPlaybackCluster::FastForwardRequest(Callback::Cancelable * onSuccessCallback,
-                                                    Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kFastForwardRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterFastForwardRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::NextRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kNextRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterNextRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::PauseRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPauseRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterPauseRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::PlayRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPlayRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterPlayRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::PreviousRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kPreviousRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterPreviousRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::RewindRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kRewindRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterRewindRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::SkipBackwardRequest(Callback::Cancelable * onSuccessCallback,
-                                                     Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSkipBackwardRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterSkipBackwardRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::SkipForwardRequest(Callback::Cancelable * onSuccessCallback,
-                                                    Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kSkipForwardRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterSkipForwardRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::StartOverRequest(Callback::Cancelable * onSuccessCallback,
-                                                  Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStartOverRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterStartOverRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-CHIP_ERROR MediaPlaybackCluster::StopRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback)
-{
-#ifdef CHIP_APP_USE_INTERACTION_MODEL
-    VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
-    (void) onSuccessCallback;
-    (void) onFailureCallback;
-
-    app::Command::CommandParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, kStopRequestCommandId,
-                                              (chip::app::Command::CommandPathFlags::kEndpointIdValid) };
-    app::Command * ZCLcommand             = mDevice->GetCommandSender();
-
-    TLV::TLVWriter writer = ZCLcommand->CreateCommandDataElementTLVWriter();
-
-    TLV::TLVType dummyType = TLV::kTLVType_NotSpecified;
-    ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, dummyType));
-
-    // Command takes no arguments.
-
-    ReturnErrorOnFailure(writer.EndContainer(dummyType));
-    ReturnErrorOnFailure(writer.Finalize());
-    ReturnErrorOnFailure(ZCLcommand->AddCommand(cmdParams));
-
-    return mDevice->SendCommands();
-#else
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterStopRequestCommand(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-#endif
-}
-
-// MediaPlayback Cluster Attributes
-CHIP_ERROR MediaPlaybackCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback,
-                                                    Callback::Cancelable * onFailureCallback)
-{
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterDiscoverAttributes(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-}
-CHIP_ERROR MediaPlaybackCluster::ReadAttributeCurrentState(Callback::Cancelable * onSuccessCallback,
-                                                           Callback::Cancelable * onFailureCallback)
-{
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterReadCurrentStateAttribute(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-}
-
-CHIP_ERROR MediaPlaybackCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback,
-                                                              Callback::Cancelable * onFailureCallback)
-{
-    uint8_t seqNum                            = mDevice->GetNextSequenceNumber();
-    System::PacketBufferHandle encodedCommand = encodeMediaPlaybackClusterReadClusterRevisionAttribute(seqNum, mEndpoint);
-    return SendCommand(seqNum, std::move(encodedCommand), onSuccessCallback, onFailureCallback);
-}
-
 // NetworkCommissioning Cluster Commands
 CHIP_ERROR NetworkCommissioningCluster::AddThreadNetwork(Callback::Cancelable * onSuccessCallback,
                                                          Callback::Cancelable * onFailureCallback,
index e3da169..4d8841a 100644 (file)
@@ -32,7 +32,6 @@ constexpr ClusterId kBarrierControlClusterId         = 0x0103;
 constexpr ClusterId kBasicClusterId                  = 0x0028;
 constexpr ClusterId kBindingClusterId                = 0xF000;
 constexpr ClusterId kColorControlClusterId           = 0x0300;
-constexpr ClusterId kContentLaunchClusterId          = 0xF002;
 constexpr ClusterId kDoorLockClusterId               = 0x0101;
 constexpr ClusterId kGeneralCommissioningClusterId   = 0x0030;
 constexpr ClusterId kGroupKeyManagementClusterId     = 0xF004;
@@ -41,7 +40,6 @@ constexpr ClusterId kIasZoneClusterId                = 0x0500;
 constexpr ClusterId kIdentifyClusterId               = 0x0003;
 constexpr ClusterId kLevelControlClusterId           = 0x0008;
 constexpr ClusterId kLowPowerClusterId               = 0x0508;
-constexpr ClusterId kMediaPlaybackClusterId          = 0xF001;
 constexpr ClusterId kNetworkCommissioningClusterId   = 0x0031;
 constexpr ClusterId kOnOffClusterId                  = 0x0006;
 constexpr ClusterId kScenesClusterId                 = 0x0005;
@@ -306,25 +304,6 @@ private:
     static constexpr CommandId kStopMoveStepCommandId           = 0x47;
 };
 
-class DLL_EXPORT ContentLaunchCluster : public ClusterBase
-{
-public:
-    ContentLaunchCluster() : ClusterBase(kContentLaunchClusterId) {}
-    ~ContentLaunchCluster() {}
-
-    // Cluster Commands
-    CHIP_ERROR LaunchContent(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR LaunchURL(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-
-    // Cluster Attributes
-    CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-
-private:
-    static constexpr CommandId kLaunchContentCommandId = 0x00;
-    static constexpr CommandId kLaunchURLCommandId     = 0x01;
-};
-
 class DLL_EXPORT DoorLockCluster : public ClusterBase
 {
 public:
@@ -577,42 +556,6 @@ private:
     static constexpr CommandId kSleepCommandId = 0x00;
 };
 
-class DLL_EXPORT MediaPlaybackCluster : public ClusterBase
-{
-public:
-    MediaPlaybackCluster() : ClusterBase(kMediaPlaybackClusterId) {}
-    ~MediaPlaybackCluster() {}
-
-    // Cluster Commands
-    CHIP_ERROR FastForwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR NextRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR PauseRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR PlayRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR PreviousRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR RewindRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR SkipBackwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR SkipForwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR StartOverRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR StopRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-
-    // Cluster Attributes
-    CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ReadAttributeCurrentState(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-    CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
-
-private:
-    static constexpr CommandId kFastForwardRequestCommandId  = 0x07;
-    static constexpr CommandId kNextRequestCommandId         = 0x05;
-    static constexpr CommandId kPauseRequestCommandId        = 0x01;
-    static constexpr CommandId kPlayRequestCommandId         = 0x00;
-    static constexpr CommandId kPreviousRequestCommandId     = 0x04;
-    static constexpr CommandId kRewindRequestCommandId       = 0x06;
-    static constexpr CommandId kSkipBackwardRequestCommandId = 0x09;
-    static constexpr CommandId kSkipForwardRequestCommandId  = 0x08;
-    static constexpr CommandId kStartOverRequestCommandId    = 0x03;
-    static constexpr CommandId kStopRequestCommandId         = 0x02;
-};
-
 class DLL_EXPORT NetworkCommissioningCluster : public ClusterBase
 {
 public:
index 0984f0c..a2746e4 100644 (file)
@@ -44,7 +44,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <support/logging/CHIPLogging.h>
 #include <system/TLVPacketBufferBackingStore.h>
@@ -262,7 +261,7 @@ CHIP_ERROR Device::OpenPairingWindow(uint32_t timeout, PairingWindowOption optio
     System::PacketBufferTLVWriter writer;
 
     writer.Init(std::move(buf));
-    writer.ImplicitProfileId = chip::Protocols::kProtocol_ServiceProvisioning;
+    writer.ImplicitProfileId = chip::Protocols::ServiceProvisioning::Id.ToTLVProfileId();
 
     ReturnErrorOnFailure(writer.Put(TLV::ProfileTag(writer.ImplicitProfileId, 1), timeout));
 
@@ -282,7 +281,7 @@ CHIP_ERROR Device::OpenPairingWindow(uint32_t timeout, PairingWindowOption optio
 
     PayloadHeader header;
 
-    header.SetMessageType(chip::Protocols::kProtocol_ServiceProvisioning, 0);
+    header.SetMessageType(chip::Protocols::ServiceProvisioning::Id, 0);
 
     ReturnErrorOnFailure(SendMessage(std::move(outBuffer), header));
 
index 4e2f9ab..8fe5274 100644 (file)
@@ -49,7 +49,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <support/TimeUtils.h>
 #include <support/logging/CHIPLogging.h>
@@ -510,8 +509,6 @@ exit:
     return err;
 }
 
-void DeviceController::OnPersistentStorageValue(const char * key, const char * value) {}
-
 void DeviceController::OnPersistentStorageStatus(const char * key, Operation op, CHIP_ERROR err) {}
 
 DeviceCommissioner::DeviceCommissioner()
index a66d19c..05fa3cd 100644 (file)
@@ -214,7 +214,6 @@ private:
     void OnConnectionExpired(SecureSessionHandle session, SecureSessionMgr * mgr) override;
 
     //////////// PersistentStorageResultDelegate Implementation ///////////////
-    void OnPersistentStorageValue(const char * key, const char * value) override;
     void OnPersistentStorageStatus(const char * key, Operation op, CHIP_ERROR err) override;
 
     void ReleaseAllDevices();
index f968557..97de6b8 100644 (file)
@@ -19,7 +19,6 @@
 #include "DeviceAddressUpdater.h"
 
 #include <controller/CHIPDeviceController.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace Controller {
index e9b2d26..320005d 100644 (file)
@@ -149,7 +149,8 @@ JNIEnv * AndroidDeviceControllerWrapper::GetJavaEnv()
     return env;
 }
 
-AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(chip::NodeId nodeId, chip::System::Layer * systemLayer,
+AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(JavaVM * vm, jobject deviceControllerObj,
+                                                                             chip::NodeId nodeId, chip::System::Layer * systemLayer,
                                                                              chip::Inet::InetLayer * inetLayer,
                                                                              CHIP_ERROR * errInfoOnFailure)
 {
@@ -182,6 +183,7 @@ AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(chi
     }
     std::unique_ptr<AndroidDeviceControllerWrapper> wrapper(new AndroidDeviceControllerWrapper(std::move(controller)));
 
+    wrapper->SetJavaObjectRef(vm, deviceControllerObj);
     wrapper->Controller()->SetUdpListenPort(CHIP_PORT + 1);
     *errInfoOnFailure = wrapper->Controller()->Init(nodeId, wrapper.get(), wrapper.get(), systemLayer, inetLayer);
 
@@ -289,38 +291,6 @@ void AndroidDeviceControllerWrapper::SetStorageDelegate(PersistentStorageResultD
     mStorageResultDelegate = delegate;
 }
 
-void AndroidDeviceControllerWrapper::AsyncGetKeyValue(const char * key)
-{
-    jstring keyString       = NULL;
-    jstring valueString     = NULL;
-    const char * valueChars = nullptr;
-    CHIP_ERROR err          = CHIP_NO_ERROR;
-    jclass storageCls       = GetPersistentStorageClass();
-    jmethodID method        = GetJavaEnv()->GetStaticMethodID(storageCls, "getKeyValue", "(Ljava/lang/String;)Ljava/lang/String;");
-
-    GetJavaEnv()->ExceptionClear();
-
-    err = N2J_NewStringUTF(GetJavaEnv(), key, keyString);
-    SuccessOrExit(err);
-
-    valueString = (jstring) GetJavaEnv()->CallStaticObjectMethod(storageCls, method, keyString);
-
-    if (mStorageResultDelegate)
-    {
-        valueChars = GetJavaEnv()->GetStringUTFChars(valueString, 0);
-        mStorageResultDelegate->OnPersistentStorageValue(key, valueChars);
-    }
-
-exit:
-    GetJavaEnv()->ExceptionClear();
-    if (valueChars != nullptr)
-    {
-        GetJavaEnv()->ReleaseStringUTFChars(valueString, valueChars);
-    }
-    GetJavaEnv()->DeleteLocalRef(keyString);
-    GetJavaEnv()->DeleteLocalRef(valueString);
-}
-
 CHIP_ERROR AndroidDeviceControllerWrapper::SyncGetKeyValue(const char * key, char * value, uint16_t & size)
 {
     jstring keyString       = NULL;
index 7f8f7ff..6a51fc6 100644 (file)
@@ -57,7 +57,6 @@ public:
 
     // PersistentStorageDelegate implementation
     void SetStorageDelegate(chip::PersistentStorageResultDelegate * delegate) override;
-    void AsyncGetKeyValue(const char * key) override;
     CHIP_ERROR SyncGetKeyValue(const char * key, char * value, uint16_t & size) override;
     void AsyncSetKeyValue(const char * key, const char * value) override;
     void AsyncDeleteKeyValue(const char * key) override;
@@ -75,8 +74,9 @@ public:
         return reinterpret_cast<AndroidDeviceControllerWrapper *>(handle);
     }
 
-    static AndroidDeviceControllerWrapper * AllocateNew(chip::NodeId nodeId, chip::System::Layer * systemLayer,
-                                                        chip::Inet::InetLayer * inetLayer, CHIP_ERROR * errInfoOnFailure);
+    static AndroidDeviceControllerWrapper * AllocateNew(JavaVM * vm, jobject deviceControllerObj, chip::NodeId nodeId,
+                                                        chip::System::Layer * systemLayer, chip::Inet::InetLayer * inetLayer,
+                                                        CHIP_ERROR * errInfoOnFailure);
 
 private:
     using ChipDeviceControllerPtr = std::unique_ptr<chip::Controller::DeviceCommissioner>;
index 1523775..8de5426 100644 (file)
@@ -37,7 +37,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <support/logging/CHIPLogging.h>
 
@@ -255,10 +254,9 @@ JNI_METHOD(jlong, newDeviceController)(JNIEnv * env, jobject self)
 
     ChipLogProgress(Controller, "newDeviceController() called");
 
-    wrapper = AndroidDeviceControllerWrapper::AllocateNew(kLocalDeviceId, &sSystemLayer, &sInetLayer, &err);
+    wrapper = AndroidDeviceControllerWrapper::AllocateNew(sJVM, self, kLocalDeviceId, &sSystemLayer, &sInetLayer, &err);
     SuccessOrExit(err);
 
-    wrapper->SetJavaObjectRef(sJVM, self);
     result = wrapper->ToJNIHandle();
 
 exit:
index a357720..937f63c 100644 (file)
@@ -22,7 +22,6 @@
 #include <app/CommandSender.h>
 #include <app/InteractionModelEngine.h>
 #include <lib/support/Span.h>
-#include <support/ReturnMacros.h>
 
 #include <controller/CHIPClusters.h>
 #include <controller/CHIPDevice.h>
@@ -244,27 +243,6 @@ CHIP_ERROR chip_ime_AppendCommand_ColorControl_StopMoveStep(chip::Controller::De
 }
 // End of Cluster ColorControl
 
-// Cluster ContentLaunch
-CHIP_ERROR chip_ime_AppendCommand_ContentLaunch_LaunchContent(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                              chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::ContentLaunchCluster clusterContentLaunch;
-    (void) ZCLgroupId;
-    clusterContentLaunch.Associate(device, ZCLendpointId);
-    return clusterContentLaunch.LaunchContent(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_ContentLaunch_LaunchURL(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                          chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::ContentLaunchCluster clusterContentLaunch;
-    (void) ZCLgroupId;
-    clusterContentLaunch.Associate(device, ZCLendpointId);
-    return clusterContentLaunch.LaunchURL(nullptr, nullptr);
-}
-// End of Cluster ContentLaunch
-
 // Cluster DoorLock
 CHIP_ERROR chip_ime_AppendCommand_DoorLock_ClearAllPins(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
                                                         chip::GroupId ZCLgroupId)
@@ -698,99 +676,6 @@ CHIP_ERROR chip_ime_AppendCommand_LowPower_Sleep(chip::Controller::Device * devi
 }
 // End of Cluster LowPower
 
-// Cluster MediaPlayback
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_FastForwardRequest(chip::Controller::Device * device,
-                                                                   chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.FastForwardRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_NextRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                            chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.NextRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_PauseRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                             chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.PauseRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_PlayRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                            chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.PlayRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_PreviousRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                                chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.PreviousRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_RewindRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                              chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.RewindRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_SkipBackwardRequest(chip::Controller::Device * device,
-                                                                    chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.SkipBackwardRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_SkipForwardRequest(chip::Controller::Device * device,
-                                                                   chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.SkipForwardRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_StartOverRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                                 chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.StartOverRequest(nullptr, nullptr);
-}
-CHIP_ERROR chip_ime_AppendCommand_MediaPlayback_StopRequest(chip::Controller::Device * device, chip::EndpointId ZCLendpointId,
-                                                            chip::GroupId ZCLgroupId)
-{
-    VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-    chip::Controller::MediaPlaybackCluster clusterMediaPlayback;
-    (void) ZCLgroupId;
-    clusterMediaPlayback.Associate(device, ZCLendpointId);
-    return clusterMediaPlayback.StopRequest(nullptr, nullptr);
-}
-// End of Cluster MediaPlayback
-
 // Cluster NetworkCommissioning
 CHIP_ERROR chip_ime_AppendCommand_NetworkCommissioning_AddThreadNetwork(chip::Controller::Device * device,
                                                                         chip::EndpointId ZCLendpointId, chip::GroupId ZCLgroupId,
index 7dd0e8e..6972f1c 100644 (file)
@@ -52,7 +52,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/DLLUtil.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 using namespace chip;
index 9873263..49fae33 100644 (file)
@@ -34,18 +34,6 @@ void PythonPersistentStorageDelegate::SetStorageDelegate(PersistentStorageResult
     mDelegate = delegate;
 }
 
-void PythonPersistentStorageDelegate::AsyncGetKeyValue(const char * key)
-{
-    auto val = mStorage.find(key);
-    if (val == mStorage.end())
-    {
-        mDelegate->OnPersistentStorageStatus(key, PersistentStorageResultDelegate::Operation::kGET, CHIP_ERROR_KEY_NOT_FOUND);
-        return;
-    }
-
-    mDelegate->OnPersistentStorageValue(key, val->second.c_str());
-}
-
 CHIP_ERROR PythonPersistentStorageDelegate::SyncGetKeyValue(const char * key, char * value, uint16_t & size)
 {
     auto val = mStorage.find(key);
index 9a1da8a..40347af 100644 (file)
@@ -37,7 +37,6 @@ class PythonPersistentStorageDelegate : public PersistentStorageDelegate
 public:
     PythonPersistentStorageDelegate() {}
     void SetStorageDelegate(PersistentStorageResultDelegate * delegate) override;
-    void AsyncGetKeyValue(const char * key) override;
     CHIP_ERROR SyncGetKeyValue(const char * key, char * value, uint16_t & size) override;
     void AsyncSetKeyValue(const char * key, const char * value) override;
     void AsyncDeleteKeyValue(const char * key) override;
index a4b6542..92e2530 100644 (file)
@@ -166,7 +166,7 @@ chip-device-ctrl > connect -ble 1383 12345678
 ## Thread provisioning
 
 1. Configure Thread border router. For example, follow
-   [Configuring Thread network on a Linux machine](../../../docs/guides/linux_thread_connectivity.md)
+   [Setup OpenThread Border Router on Raspberry Pi / ubuntu](../../../docs/guides/openthread_border_router_pi.md)
    instruction to configure OpenThread Border Router on a Linux workstation.
 
 2. Run CHIP Device Controller
index fd5c48f..060ec87 100644 (file)
@@ -157,12 +157,6 @@ class ChipCluster:
                     "optionsOverride": "int",
                 },
             },
-            "ContentLaunch": {
-                "LaunchContent": {
-                },
-                "LaunchURL": {
-                },
-            },
             "DoorLock": {
                 "ClearAllPins": {
                 },
@@ -348,28 +342,6 @@ class ChipCluster:
                 "Sleep": {
                 },
             },
-            "MediaPlayback": {
-                "FastForwardRequest": {
-                },
-                "NextRequest": {
-                },
-                "PauseRequest": {
-                },
-                "PlayRequest": {
-                },
-                "PreviousRequest": {
-                },
-                "RewindRequest": {
-                },
-                "SkipBackwardRequest": {
-                },
-                "SkipForwardRequest": {
-                },
-                "StartOverRequest": {
-                },
-                "StopRequest": {
-                },
-            },
             "NetworkCommissioning": {
                 "AddThreadNetwork": {
                     "operationalDataset": "bytes",
@@ -602,20 +574,6 @@ class ChipCluster:
             )
         )
 
-    def ClusterContentLaunch_CommandLaunchContent(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchContent(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterContentLaunch_CommandLaunchURL(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchURL(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
     def ClusterDoorLock_CommandClearAllPins(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_DoorLock_ClearAllPins(
@@ -924,76 +882,6 @@ class ChipCluster:
             )
         )
 
-    def ClusterMediaPlayback_CommandFastForwardRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_FastForwardRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandNextRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_NextRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandPauseRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_PauseRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandPlayRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_PlayRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandPreviousRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_PreviousRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandRewindRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_RewindRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandSkipBackwardRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipBackwardRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandSkipForwardRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipForwardRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandStartOverRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_StartOverRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
-    def ClusterMediaPlayback_CommandStopRequest(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int):
-        self._ChipStack.Call(
-            lambda: self._chipLib.chip_ime_AppendCommand_MediaPlayback_StopRequest(
-                device, ZCLendpoint, ZCLgroupid
-            )
-        )
-
     def ClusterNetworkCommissioning_CommandAddThreadNetwork(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int, operationalDataset: bytes, breadcrumb: int, timeoutMs: int):
         self._ChipStack.Call(
             lambda: self._chipLib.chip_ime_AppendCommand_NetworkCommissioning_AddThreadNetwork(
@@ -1192,13 +1080,6 @@ class ChipCluster:
         # Cluster ColorControl Command StopMoveStep
         self._chipLib.chip_ime_AppendCommand_ColorControl_StopMoveStep.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_uint8, ctypes.c_uint8]
         self._chipLib.chip_ime_AppendCommand_ColorControl_StopMoveStep.restype = ctypes.c_uint32
-        # Cluster ContentLaunch
-        # Cluster ContentLaunch Command LaunchContent
-        self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchContent.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchContent.restype = ctypes.c_uint32
-        # Cluster ContentLaunch Command LaunchURL
-        self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchURL.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_ContentLaunch_LaunchURL.restype = ctypes.c_uint32
         # Cluster DoorLock
         # Cluster DoorLock Command ClearAllPins
         self._chipLib.chip_ime_AppendCommand_DoorLock_ClearAllPins.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
@@ -1336,37 +1217,6 @@ class ChipCluster:
         # Cluster LowPower Command Sleep
         self._chipLib.chip_ime_AppendCommand_LowPower_Sleep.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
         self._chipLib.chip_ime_AppendCommand_LowPower_Sleep.restype = ctypes.c_uint32
-        # Cluster MediaPlayback
-        # Cluster MediaPlayback Command FastForwardRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_FastForwardRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_FastForwardRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command NextRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_NextRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_NextRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command PauseRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PauseRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PauseRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command PlayRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PlayRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PlayRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command PreviousRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PreviousRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_PreviousRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command RewindRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_RewindRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_RewindRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command SkipBackwardRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipBackwardRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipBackwardRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command SkipForwardRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipForwardRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_SkipForwardRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command StartOverRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_StartOverRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_StartOverRequest.restype = ctypes.c_uint32
-        # Cluster MediaPlayback Command StopRequest
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_StopRequest.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16]
-        self._chipLib.chip_ime_AppendCommand_MediaPlayback_StopRequest.restype = ctypes.c_uint32
         # Cluster NetworkCommissioning
         # Cluster NetworkCommissioning Command AddThreadNetwork
         self._chipLib.chip_ime_AppendCommand_NetworkCommissioning_AddThreadNetwork.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16, ctypes.c_char_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.c_uint32]
index 511f35f..bbed0b6 100644 (file)
@@ -4,7 +4,6 @@
 #include <platform/Linux/bluez/MainLoop.h>
 #include <platform/internal/BLEManager.h>
 #include <support/CHIPMem.h>
-#include <support/ReturnMacros.h>
 
 using namespace chip::DeviceLayer::Internal;
 
index 001d14b..51a55b6 100644 (file)
@@ -1,5 +1,4 @@
 #include <support/CHIPMem.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 #import <CoreBluetooth/CoreBluetooth.h>
index 79623e9..a68f0cb 100644 (file)
@@ -2,7 +2,6 @@
 #include <ble/CHIPBleServiceData.h>
 #include <platform/Darwin/UUIDHelper.h>
 #include <support/CHIPMem.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 #import <CoreBluetooth/CoreBluetooth.h>
index 071ab7e..0aa1ab4 100644 (file)
@@ -30,26 +30,6 @@ class ServerStorageDelegate : public chip::PersistentStorageDelegate
 public:
     void SetStorageDelegate(chip::PersistentStorageResultDelegate * delegate) override { mAsyncDelegate = delegate; }
 
-    void AsyncGetKeyValue(const char * key) override
-    {
-        // TODO: Async Get/Set are implemented synchronously here.
-        // We need to figure out a standard way to implement this - this implementation
-        // was based on an example that just returned and that seemed even less useful.
-        uint8_t buffer[kMaxKeyValueSize];
-        uint16_t bufferSize = sizeof(buffer) - 1;
-        CHIP_ERROR err      = SyncGetKeyValue(key, buffer, bufferSize);
-
-        if (err == CHIP_NO_ERROR)
-        {
-            buffer[bufferSize] = 0;
-            mAsyncDelegate->OnPersistentStorageValue(key, reinterpret_cast<const char *>(buffer));
-        }
-        else
-        {
-            mAsyncDelegate->OnPersistentStorageStatus(key, chip::PersistentStorageResultDelegate::Operation::kGET, err);
-        }
-    }
-
     void AsyncSetKeyValue(const char * key, const char * value) override
     {
 
@@ -75,8 +55,6 @@ public:
     void AsyncDeleteKeyValue(const char * key) override { chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Delete(key); }
 
 private:
-    static constexpr size_t kMaxKeyValueSize = 1024;
-
     chip::PersistentStorageResultDelegate * mAsyncDelegate = nullptr;
 };
 
index b7800ec..1e7023d 100644 (file)
@@ -149,9 +149,9 @@ CHIP_ERROR ChipCertificateSet::LoadCert(const uint8_t * chipCert, uint32_t chipC
     TLVReader reader;
 
     reader.Init(chipCert, chipCertLen);
-    reader.ImplicitProfileId = kProtocol_OpCredentials;
+    reader.ImplicitProfileId = Protocols::OpCredentials::Id.ToTLVProfileId();
 
-    err = reader.Next(kTLVType_Structure, ProfileTag(kProtocol_OpCredentials, kTag_ChipCertificate));
+    err = reader.Next(kTLVType_Structure, ProfileTag(Protocols::OpCredentials::Id.ToTLVProfileId(), kTag_ChipCertificate));
     SuccessOrExit(err);
 
     err = LoadCert(reader, decodeFlags);
@@ -254,7 +254,7 @@ CHIP_ERROR ChipCertificateSet::LoadCerts(const uint8_t * chipCerts, uint32_t chi
     uint64_t tag;
 
     reader.Init(chipCerts, chipCertsLen);
-    reader.ImplicitProfileId = kProtocol_OpCredentials;
+    reader.ImplicitProfileId = Protocols::OpCredentials::Id.ToTLVProfileId();
 
     err = reader.Next();
     SuccessOrExit(err);
@@ -262,9 +262,10 @@ CHIP_ERROR ChipCertificateSet::LoadCerts(const uint8_t * chipCerts, uint32_t chi
     type = reader.GetType();
     tag  = reader.GetTag();
 
-    VerifyOrExit((type == kTLVType_Structure && tag == ProfileTag(kProtocol_OpCredentials, kTag_ChipCertificate)) ||
-                     (type == kTLVType_Array && tag == ProfileTag(kProtocol_OpCredentials, kTag_ChipCertificateArray)),
-                 err = CHIP_ERROR_UNEXPECTED_TLV_ELEMENT);
+    VerifyOrExit(
+        (type == kTLVType_Structure && tag == ProfileTag(Protocols::OpCredentials::Id.ToTLVProfileId(), kTag_ChipCertificate)) ||
+            (type == kTLVType_Array && tag == ProfileTag(Protocols::OpCredentials::Id.ToTLVProfileId(), kTag_ChipCertificateArray)),
+        err = CHIP_ERROR_UNEXPECTED_TLV_ELEMENT);
 
     err = LoadCerts(reader, decodeFlags);
 
index 4f88549..428be7e 100644 (file)
@@ -505,7 +505,8 @@ static CHIP_ERROR ConvertCertificate(ASN1Reader & reader, TLVWriter & writer)
     OID sigAlgoOID;
     TLVType containerType;
 
-    err = writer.StartContainer(ProfileTag(kProtocol_OpCredentials, kTag_ChipCertificate), kTLVType_Structure, containerType);
+    err = writer.StartContainer(ProfileTag(Protocols::OpCredentials::Id.ToTLVProfileId(), kTag_ChipCertificate), kTLVType_Structure,
+                                containerType);
     SuccessOrExit(err);
 
     // Certificate ::= SEQUENCE
index 3a2c09c..11e52b3 100644 (file)
@@ -833,7 +833,7 @@ static CHIP_ERROR DecodeConvertCert(TLVReader & reader, ASN1Writer & writer, Chi
     }
     VerifyOrExit(reader.GetType() == kTLVType_Structure, err = CHIP_ERROR_WRONG_TLV_TYPE);
     tag = reader.GetTag();
-    VerifyOrExit(tag == ProfileTag(kProtocol_OpCredentials, kTag_ChipCertificate) || tag == AnonymousTag,
+    VerifyOrExit(tag == ProfileTag(Protocols::OpCredentials::Id.ToTLVProfileId(), kTag_ChipCertificate) || tag == AnonymousTag,
                  err = CHIP_ERROR_UNEXPECTED_TLV_ELEMENT);
 
     err = reader.EnterContainer(containerType);
index 84d0604..18ba332 100644 (file)
@@ -23,15 +23,16 @@ FOUNDATION_EXPORT NSErrorDomain const CHIPErrorDomain;
 typedef int32_t CHIP_ERROR;
 
 typedef NS_ERROR_ENUM(CHIPErrorDomain, CHIPErrorCode) {
-    CHIPErrorCodeUndefinedError = 0,
-    CHIPErrorCodeInvalidStringLength = 1,
-    CHIPErrorCodeInvalidIntegerValue = 2,
-    CHIPErrorCodeInvalidArgument = 3,
-    CHIPErrorCodeInvalidMessageLength = 4,
-    CHIPErrorCodeInvalidState = 5,
-    CHIPErrorCodeWrongAddressType = 6,
-    CHIPErrorCodeIntegrityCheckFailed = 7,
-    CHIPSuccess = 8,
+    CHIPSuccess = 0,
+    CHIPErrorCodeUndefinedError = 1,
+    CHIPErrorCodeInvalidStringLength = 2,
+    CHIPErrorCodeInvalidIntegerValue = 3,
+    CHIPErrorCodeInvalidArgument = 4,
+    CHIPErrorCodeInvalidMessageLength = 5,
+    CHIPErrorCodeInvalidState = 6,
+    CHIPErrorCodeWrongAddressType = 7,
+    CHIPErrorCodeIntegrityCheckFailed = 8,
+    CHIPErrorCodeDuplicateExists = 9,
 };
 
 @interface CHIPError : NSObject
index 5476109..bc150a3 100644 (file)
@@ -17,6 +17,7 @@
 
 #import "CHIPError.h"
 
+#import <app/util/af-enums.h>
 #import <core/CHIPError.h>
 #import <inet/InetError.h>
 
@@ -51,6 +52,11 @@ NSString * const CHIPErrorDomain = @"CHIPErrorDomain";
         return [NSError errorWithDomain:CHIPErrorDomain
                                    code:CHIPErrorCodeIntegrityCheckFailed
                                userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Integrity check failed.", nil) }];
+    case EMBER_ZCL_STATUS_DUPLICATE_EXISTS:
+        return [NSError
+            errorWithDomain:CHIPErrorDomain
+                       code:CHIPErrorCodeDuplicateExists
+                   userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"A Duplicate entry or setting exists.", nil) }];
     case CHIP_NO_ERROR:
         return [NSError errorWithDomain:CHIPErrorDomain
                                    code:CHIPSuccess
@@ -58,7 +64,10 @@ NSString * const CHIPErrorDomain = @"CHIPErrorDomain";
     default:
         return [NSError errorWithDomain:CHIPErrorDomain
                                    code:CHIPErrorCodeUndefinedError
-                               userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Undefined error.", nil) }];
+                               userInfo:@{
+                                   NSLocalizedDescriptionKey :
+                                       [NSString stringWithFormat:NSLocalizedString(@"Undefined error:%d.", nil), errorCode]
+                               }];
         ;
     }
 }
@@ -70,6 +79,8 @@ NSString * const CHIPErrorDomain = @"CHIPErrorDomain";
     }
 
     switch (error.code) {
+    case CHIPErrorCodeDuplicateExists:
+        return EMBER_ZCL_STATUS_DUPLICATE_EXISTS;
     case CHIPErrorCodeInvalidStringLength:
         return CHIP_ERROR_INVALID_STRING_LENGTH;
     case CHIPErrorCodeInvalidIntegerValue:
index 144ff0a..6ba417f 100644 (file)
@@ -32,8 +32,6 @@ public:
 
     void SetStorageDelegate(chip::PersistentStorageResultDelegate * delegate) override;
 
-    void AsyncGetKeyValue(const char * key) override;
-
     CHIP_ERROR SyncGetKeyValue(const char * key, char * value, uint16_t & size) override;
 
     void AsyncSetKeyValue(const char * key, const char * value) override;
@@ -45,7 +43,6 @@ private:
     dispatch_queue_t mQueue;
 
     chip::PersistentStorageResultDelegate * mCallback;
-    SendKeyValue mCompletionHandler;
     CHIPSendSetStatus mSetStatusHandler;
     CHIPSendDeleteStatus mDeleteStatusHandler;
     NSUserDefaults * mDefaultPersistentStorage;
index 71a2814..f07eb2d 100644 (file)
@@ -45,15 +45,6 @@ void CHIPPersistentStorageDelegateBridge::SetStorageDelegate(chip::PersistentSto
         if (delegate) {
             mCallback = delegate;
 
-            mCompletionHandler = ^(NSString * key, NSString * value) {
-                chip::PersistentStorageResultDelegate * callback = mCallback;
-                if (callback) {
-                    dispatch_async(mWorkQueue, ^{
-                        callback->OnPersistentStorageValue([key UTF8String], [value UTF8String]);
-                    });
-                }
-            };
-
             mSetStatusHandler = ^(NSString * key, NSError * status) {
                 chip::PersistentStorageResultDelegate * callback = mCallback;
                 if (callback) {
@@ -75,34 +66,12 @@ void CHIPPersistentStorageDelegateBridge::SetStorageDelegate(chip::PersistentSto
             };
         } else {
             mCallback = nil;
-            mCompletionHandler = nil;
             mSetStatusHandler = nil;
             mDeleteStatusHandler = nil;
         }
     });
 }
 
-void CHIPPersistentStorageDelegateBridge::AsyncGetKeyValue(const char * key)
-{
-    NSString * keyString = [NSString stringWithUTF8String:key];
-    dispatch_async(mWorkQueue, ^{
-        NSLog(@"PersistentStorageDelegate Get Value for Key: %@", keyString);
-
-        id<CHIPPersistentStorageDelegate> strongDelegate = mDelegate;
-        if (strongDelegate && mQueue) {
-            dispatch_async(mQueue, ^{
-                [strongDelegate CHIPGetKeyValue:keyString handler:mCompletionHandler];
-            });
-        } else {
-            NSString * value = [mDefaultPersistentStorage objectForKey:keyString];
-            NSLog(@"PersistentStorageDelegate Get Value for Key: %@, value %@", keyString, value);
-            if (mCompletionHandler) {
-                mCompletionHandler(keyString, value);
-            }
-        }
-    });
-}
-
 CHIP_ERROR CHIPPersistentStorageDelegateBridge::SyncGetKeyValue(const char * key, char * value, uint16_t & size)
 {
     __block CHIP_ERROR error = CHIP_NO_ERROR;
index 71fe6c6..2f78e0b 100644 (file)
@@ -686,32 +686,6 @@ bool emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16
     return true;
 }
 
-bool emberAfContentLaunchClusterLaunchContentResponseCallback(uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(Zcl, "LaunchContentResponse:");
-    ChipLogProgress(Zcl, "  contentLaunchStatus: %" PRIu8 "", contentLaunchStatus);
-
-    GET_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchContentResponseCallback");
-
-    Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback> * cb =
-        Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback>::FromCancelable(onSuccessCallback);
-    cb->mCall(cb->mContext, contentLaunchStatus);
-    return true;
-}
-
-bool emberAfContentLaunchClusterLaunchURLResponseCallback(uint8_t contentLaunchStatus)
-{
-    ChipLogProgress(Zcl, "LaunchURLResponse:");
-    ChipLogProgress(Zcl, "  contentLaunchStatus: %" PRIu8 "", contentLaunchStatus);
-
-    GET_RESPONSE_CALLBACKS("ContentLaunchClusterLaunchURLResponseCallback");
-
-    Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback> * cb =
-        Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback>::FromCancelable(onSuccessCallback);
-    cb->mCall(cb->mContext, contentLaunchStatus);
-    return true;
-}
-
 bool emberAfDoorLockClusterClearAllPinsResponseCallback(uint8_t status)
 {
     ChipLogProgress(Zcl, "ClearAllPinsResponse:");
index 00c37b8..a6adcbc 100644 (file)
@@ -39,8 +39,6 @@ typedef void (*ReadReportingConfigurationReportedCallback)(void * context, uint1
 typedef void (*ReadReportingConfigurationReceivedCallback)(void * context, uint16_t timeout);
 
 // Cluster Specific Response Callbacks
-typedef void (*ContentLaunchClusterLaunchContentResponseCallback)(void * context, uint8_t contentLaunchStatus);
-typedef void (*ContentLaunchClusterLaunchURLResponseCallback)(void * context, uint8_t contentLaunchStatus);
 typedef void (*DoorLockClusterClearAllPinsResponseCallback)(void * context);
 typedef void (*DoorLockClusterClearAllRfidsResponseCallback)(void * context);
 typedef void (*DoorLockClusterClearHolidayScheduleResponseCallback)(void * context);
@@ -82,7 +80,6 @@ typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context,
 typedef void (*GroupsClusterRemoveGroupResponseCallback)(void * context, uint16_t groupId);
 typedef void (*GroupsClusterViewGroupResponseCallback)(void * context, uint16_t groupId, uint8_t * groupName);
 typedef void (*IdentifyClusterIdentifyQueryResponseCallback)(void * context, uint16_t timeout);
-typedef void (*MediaPlaybackClusterPlaybackCallback)(void * context);
 typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId);
 typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId,
                                                                 uint8_t sceneCount,
index 847dc97..93e5db9 100644 (file)
@@ -301,19 +301,6 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
- * Cluster Content Launch
- *
- */
-@interface CHIPContentLaunch : CHIPCluster
-
-- (void)launchContent:(ResponseHandler)completionHandler;
-- (void)launchURL:(ResponseHandler)completionHandler;
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
-
-@end
-
-/**
  * Cluster Door Lock
  *
  */
@@ -492,28 +479,6 @@ NS_ASSUME_NONNULL_BEGIN
 @end
 
 /**
- * Cluster Media Playback
- *
- */
-@interface CHIPMediaPlayback : CHIPCluster
-
-- (void)fastForwardRequest:(ResponseHandler)completionHandler;
-- (void)nextRequest:(ResponseHandler)completionHandler;
-- (void)pauseRequest:(ResponseHandler)completionHandler;
-- (void)playRequest:(ResponseHandler)completionHandler;
-- (void)previousRequest:(ResponseHandler)completionHandler;
-- (void)rewindRequest:(ResponseHandler)completionHandler;
-- (void)skipBackwardRequest:(ResponseHandler)completionHandler;
-- (void)skipForwardRequest:(ResponseHandler)completionHandler;
-- (void)startOverRequest:(ResponseHandler)completionHandler;
-- (void)stopRequest:(ResponseHandler)completionHandler;
-
-- (void)readAttributeCurrentState:(ResponseHandler)completionHandler;
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;
-
-@end
-
-/**
  * Cluster On/off
  *
  */
index f256509..3a8c26e 100644 (file)
@@ -74,9 +74,7 @@ public:
         CHIPDefaultFailureCallbackBridge * callback = reinterpret_cast<CHIPDefaultFailureCallbackBridge *>(context);
         if (callback && callback->mQueue) {
             dispatch_async(callback->mQueue, ^{
-                NSError * error = [NSError errorWithDomain:CHIPErrorDomain
-                                                      code:status
-                                                  userInfo:@ { NSLocalizedDescriptionKey : @"" }];
+                NSError * error = [CHIPError errorForCHIPErrorCode:status];
                 callback->mHandler(error, nil);
                 callback->Cancel();
                 delete callback;
@@ -356,70 +354,6 @@ private:
     bool mKeepAlive;
 };
 
-class CHIPContentLaunchClusterLaunchContentResponseCallbackBridge
-    : public Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback> {
-public:
-    CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<ContentLaunchClusterLaunchContentResponseCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPContentLaunchClusterLaunchContentResponseCallbackBridge() {};
-
-    static void CallbackFn(void * context, uint8_t contentLaunchStatus)
-    {
-        CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * callback
-            = reinterpret_cast<CHIPContentLaunchClusterLaunchContentResponseCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {
-                    @"contentLaunchStatus" : [NSNumber numberWithUnsignedChar:contentLaunchStatus],
-                });
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
-class CHIPContentLaunchClusterLaunchURLResponseCallbackBridge
-    : public Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback> {
-public:
-    CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<ContentLaunchClusterLaunchURLResponseCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPContentLaunchClusterLaunchURLResponseCallbackBridge() {};
-
-    static void CallbackFn(void * context, uint8_t contentLaunchStatus)
-    {
-        CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * callback
-            = reinterpret_cast<CHIPContentLaunchClusterLaunchURLResponseCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {
-                    @"contentLaunchStatus" : [NSNumber numberWithUnsignedChar:contentLaunchStatus],
-                });
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
 class CHIPDoorLockClusterClearAllPinsResponseCallbackBridge
     : public Callback::Callback<DoorLockClusterClearAllPinsResponseCallback> {
 public:
@@ -1403,35 +1337,6 @@ private:
     dispatch_queue_t mQueue;
 };
 
-class CHIPMediaPlaybackClusterPlaybackCallbackBridge : public Callback::Callback<MediaPlaybackClusterPlaybackCallback> {
-public:
-    CHIPMediaPlaybackClusterPlaybackCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
-        : Callback::Callback<MediaPlaybackClusterPlaybackCallback>(CallbackFn, this)
-        , mHandler(handler)
-        , mQueue(queue)
-    {
-    }
-
-    ~CHIPMediaPlaybackClusterPlaybackCallbackBridge() {};
-
-    static void CallbackFn(void * context)
-    {
-        CHIPMediaPlaybackClusterPlaybackCallbackBridge * callback
-            = reinterpret_cast<CHIPMediaPlaybackClusterPlaybackCallbackBridge *>(context);
-        if (callback && callback->mQueue) {
-            dispatch_async(callback->mQueue, ^{
-                callback->mHandler(nil, @ {});
-                callback->Cancel();
-                delete callback;
-            });
-        }
-    };
-
-private:
-    ResponseHandler mHandler;
-    dispatch_queue_t mQueue;
-};
-
 class CHIPScenesClusterAddSceneResponseCallbackBridge : public Callback::Callback<ScenesClusterAddSceneResponseCallback> {
 public:
     CHIPScenesClusterAddSceneResponseCallbackBridge(ResponseHandler handler, dispatch_queue_t queue)
@@ -4577,89 +4482,6 @@ private:
 
 @end
 
-@interface CHIPContentLaunch ()
-@property (readonly) Controller::ContentLaunchCluster cppCluster;
-@end
-
-@implementation CHIPContentLaunch
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)launchContent:(ResponseHandler)completionHandler
-{
-    CHIPContentLaunchClusterLaunchContentResponseCallbackBridge * onSuccess
-        = new CHIPContentLaunchClusterLaunchContentResponseCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.LaunchContent(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)launchURL:(ResponseHandler)completionHandler
-{
-    CHIPContentLaunchClusterLaunchURLResponseCallbackBridge * onSuccess
-        = new CHIPContentLaunchClusterLaunchURLResponseCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.LaunchURL(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-@end
-
 @interface CHIPDoorLock ()
 @property (readonly) Controller::DoorLockCluster cppCluster;
 @end
@@ -6244,286 +6066,6 @@ private:
 
 @end
 
-@interface CHIPMediaPlayback ()
-@property (readonly) Controller::MediaPlaybackCluster cppCluster;
-@end
-
-@implementation CHIPMediaPlayback
-
-- (Controller::ClusterBase *)getCluster
-{
-    return &_cppCluster;
-}
-
-- (void)fastForwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.FastForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)nextRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.NextRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)pauseRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PauseRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)playRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PlayRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)previousRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.PreviousRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)rewindRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.RewindRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)skipBackwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.SkipBackwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)skipForwardRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.SkipForwardRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)startOverRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.StartOverRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-- (void)stopRequest:(ResponseHandler)completionHandler
-{
-    CHIPDefaultSuccessCallbackBridge * onSuccess = new CHIPDefaultSuccessCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.StopRequest(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeCurrentState:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeCurrentState(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler
-{
-    CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onSuccess) {
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(completionHandler, [self callbackQueue]);
-    if (!onFailure) {
-        delete onSuccess;
-        completionHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil);
-        return;
-    }
-
-    CHIP_ERROR err = self.cppCluster.ReadAttributeClusterRevision(onSuccess->Cancel(), onFailure->Cancel());
-    if (err != CHIP_NO_ERROR) {
-        delete onSuccess;
-        delete onFailure;
-        completionHandler([CHIPError errorForCHIPErrorCode:err], nil);
-    }
-}
-
-@end
-
 @interface CHIPOnOff ()
 @property (readonly) Controller::OnOffCluster cppCluster;
 @end
index 3adebeb..77b9ff3 100644 (file)
@@ -39,77 +39,6 @@ namespace app {
 
 namespace clusters {
 
-namespace ContentLaunch {
-
-void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID: {
-            CHIP_ERROR TLVError = CHIP_NO_ERROR;
-            uint8_t contentLaunchStatus;
-
-            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
-            {
-                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
-                {
-                case 0:
-                    TLVError = dataTlv.Get(contentLaunchStatus);
-                    break;
-                default:
-                    // Unsupported tag, ignore it.
-                    ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
-                    break;
-                }
-                if (TLVError != CHIP_NO_ERROR)
-                {
-                    ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
-                                    TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
-                }
-            }
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchContentResponseCallback(contentLaunchStatus);
-            break;
-        }
-        case ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID: {
-            CHIP_ERROR TLVError = CHIP_NO_ERROR;
-            uint8_t contentLaunchStatus;
-
-            while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
-            {
-                switch (TLV::TagNumFromTag(dataTlv.GetTag()))
-                {
-                case 0:
-                    TLVError = dataTlv.Get(contentLaunchStatus);
-                    break;
-                default:
-                    // Unsupported tag, ignore it.
-                    ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
-                    break;
-                }
-                if (TLVError != CHIP_NO_ERROR)
-                {
-                    ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32,
-                                    TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
-                }
-            }
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfContentLaunchClusterLaunchURLResponseCallback(contentLaunchStatus);
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_CONTENT_LAUNCH_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace ContentLaunch
-
 namespace DoorLock {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
@@ -1144,30 +1073,6 @@ void DispatchClientCommand(app::Command * command, CommandId commandId, Endpoint
 
 } // namespace Identify
 
-namespace MediaPlayback {
-
-void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
-{
-    {
-        switch (commandId)
-        {
-        case ZCL_PLAYBACK_COMMAND_ID: {
-            // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
-            emberAfMediaPlaybackClusterPlaybackCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            // TODO: Encode response for command not found
-            ChipLogError(Zcl, "Unknown command %" PRIx16 " for cluster %" PRIx16, commandId, ZCL_MEDIA_PLAYBACK_CLUSTER_ID);
-            break;
-        }
-        }
-    }
-}
-
-} // namespace MediaPlayback
-
 namespace Scenes {
 
 void DispatchClientCommand(app::Command * command, CommandId commandId, EndpointId endpointId, TLV::TLVReader & dataTlv)
index 6ca0739..0fd312a 100644 (file)
 // Server attributes
 #define ZCL_MAX_DURATION_ATTRIBUTE_ID (0x0000)
 
+// Attribute ids for cluster: Media Playback
+
+// Client attributes
+
+// Server attributes
+#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
+
 // Attribute ids for cluster: Low Power
 
 // Client attributes
 
 // Server attributes
 
+// Attribute ids for cluster: Content Launch
+
+// Client attributes
+
+// Server attributes
+
 // Attribute ids for cluster: Application Basic
 
 // Client attributes
 
 // Server attributes
 
-// Attribute ids for cluster: Media Playback
-
-// Client attributes
-
-// Server attributes
-#define ZCL_CURRENT_STATE_ATTRIBUTE_ID (0x0000)
-
-// Attribute ids for cluster: Content Launch
-
-// Client attributes
-
-// Server attributes
-
 // Attribute ids for cluster: Group Key Management
 
 // Client attributes
index 1105f41..66538a8 100644 (file)
@@ -33,14 +33,12 @@ EmberAfStatus emberAfBarrierControlClusterClientCommandParse(EmberAfClusterComma
 EmberAfStatus emberAfBasicClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfBindingClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfColorControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfContentLaunchClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGeneralCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLevelControlClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfLowPowerClusterClientCommandParse(EmberAfClusterCommand * cmd);
-EmberAfStatus emberAfMediaPlaybackClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfOnOffClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd);
 EmberAfStatus emberAfTemperatureMeasurementClusterClientCommandParse(EmberAfClusterCommand * cmd);
@@ -94,9 +92,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             // No commands are enabled for cluster Color Control
             result = status(false, true, cmd->mfgSpecific);
             break;
-        case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-            result = emberAfContentLaunchClusterClientCommandParse(cmd);
-            break;
         case ZCL_DOOR_LOCK_CLUSTER_ID:
             result = emberAfDoorLockClusterClientCommandParse(cmd);
             break;
@@ -117,9 +112,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
             // No commands are enabled for cluster Low Power
             result = status(false, true, cmd->mfgSpecific);
             break;
-        case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-            result = emberAfMediaPlaybackClusterClientCommandParse(cmd);
-            break;
         case ZCL_ON_OFF_CLUSTER_ID:
             // No commands are enabled for cluster On/off
             result = status(false, true, cmd->mfgSpecific);
@@ -151,48 +143,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
 
 // Cluster specific command parsing
 
-EmberAfStatus emberAfContentLaunchClusterClientCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID: {
-            uint16_t payloadOffset = cmd->payloadStartIndex;
-            uint8_t contentLaunchStatus;
-
-            if (cmd->bufLen < payloadOffset + 1)
-            {
-                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
-            }
-            contentLaunchStatus = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
-
-            wasHandled = emberAfContentLaunchClusterLaunchContentResponseCallback(contentLaunchStatus);
-            break;
-        }
-        case ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID: {
-            uint16_t payloadOffset = cmd->payloadStartIndex;
-            uint8_t contentLaunchStatus;
-
-            if (cmd->bufLen < payloadOffset + 1)
-            {
-                return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
-            }
-            contentLaunchStatus = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
-
-            wasHandled = emberAfContentLaunchClusterLaunchURLResponseCallback(contentLaunchStatus);
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfDoorLockClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
@@ -919,26 +869,6 @@ EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * c
     }
     return status(wasHandled, true, cmd->mfgSpecific);
 }
-EmberAfStatus emberAfMediaPlaybackClusterClientCommandParse(EmberAfClusterCommand * cmd)
-{
-    bool wasHandled = false;
-
-    if (!cmd->mfgSpecific)
-    {
-        switch (cmd->commandId)
-        {
-        case ZCL_PLAYBACK_COMMAND_ID: {
-            wasHandled = emberAfMediaPlaybackClusterPlaybackCallback();
-            break;
-        }
-        default: {
-            // Unrecognized command ID, error status will apply.
-            break;
-        }
-        }
-    }
-    return status(wasHandled, true, cmd->mfgSpecific);
-}
 EmberAfStatus emberAfScenesClusterClientCommandParse(EmberAfClusterCommand * cmd)
 {
     bool wasHandled = false;
index 45377fe..2e044ef 100644 (file)
@@ -44,9 +44,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_COLOR_CONTROL_CLUSTER_ID:
         emberAfColorControlClusterInitCallback(endpoint);
         break;
-    case ZCL_CONTENT_LAUNCH_CLUSTER_ID:
-        emberAfContentLaunchClusterInitCallback(endpoint);
-        break;
     case ZCL_DOOR_LOCK_CLUSTER_ID:
         emberAfDoorLockClusterInitCallback(endpoint);
         break;
@@ -65,9 +62,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
     case ZCL_LOW_POWER_CLUSTER_ID:
         emberAfLowPowerClusterInitCallback(endpoint);
         break;
-    case ZCL_MEDIA_PLAYBACK_CLUSTER_ID:
-        emberAfMediaPlaybackClusterInitCallback(endpoint);
-        break;
     case ZCL_ON_OFF_CLUSTER_ID:
         emberAfOnOffClusterInitCallback(endpoint);
         break;
@@ -108,11 +102,6 @@ void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId end
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfContentLaunchClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfDoorLockClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
@@ -143,11 +132,6 @@ void __attribute__((weak)) emberAfLowPowerClusterInitCallback(EndpointId endpoin
     // To prevent warning
     (void) endpoint;
 }
-void __attribute__((weak)) emberAfMediaPlaybackClusterInitCallback(EndpointId endpoint)
-{
-    // To prevent warning
-    (void) endpoint;
-}
 void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
 {
     // To prevent warning
index c3243df..0de9f0d 100644 (file)
@@ -79,14 +79,6 @@ void emberAfBindingClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfColorControlClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Content Launch Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief Door Lock Cluster Init
  *
  * Cluster Init
@@ -135,14 +127,6 @@ void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
  */
 void emberAfLowPowerClusterInitCallback(chip::EndpointId endpoint);
 
-/** @brief Media Playback Cluster Init
- *
- * Cluster Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterInitCallback(chip::EndpointId endpoint);
-
 /** @brief On/off Cluster Init
  *
  * Cluster Init
@@ -520,76 +504,6 @@ EmberAfStatus emberAfColorControlClusterClientPreAttributeChangedCallback(chip::
 void emberAfColorControlClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
-// Content Launch Cluster client
-//
-
-/** @brief Content Launch Cluster Client Init
- *
- * Client Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfContentLaunchClusterClientInitCallback(chip::EndpointId endpoint);
-
-/** @brief Content Launch Cluster Client Attribute Changed
- *
- * Client Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfContentLaunchClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Content Launch Cluster Client Manufacturer Specific Attribute Changed
- *
- * Client Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfContentLaunchClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Content Launch Cluster Client Message Sent
- *
- * Client Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfContentLaunchClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Content Launch Cluster Client Pre Attribute Changed
- *
- * client Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfContentLaunchClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Content Launch Cluster Client Tick
- *
- * client Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfContentLaunchClusterClientTickCallback(chip::EndpointId endpoint);
-
-//
 // Door Lock Cluster client
 //
 
@@ -1011,76 +925,6 @@ EmberAfStatus emberAfLowPowerClusterClientPreAttributeChangedCallback(chip::Endp
 void emberAfLowPowerClusterClientTickCallback(chip::EndpointId endpoint);
 
 //
-// Media Playback Cluster client
-//
-
-/** @brief Media Playback Cluster Client Init
- *
- * Client Init
- *
- * @param endpoint    Endpoint that is being initialized
- */
-void emberAfMediaPlaybackClusterClientInitCallback(chip::EndpointId endpoint);
-
-/** @brief Media Playback Cluster Client Attribute Changed
- *
- * Client Attribute Changed
- *
- * @param endpoint    Endpoint that is being initialized
- * @param attributeId Attribute that changed
- */
-void emberAfMediaPlaybackClusterClientAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
-
-/** @brief Media Playback Cluster Client Manufacturer Specific Attribute Changed
- *
- * Client Manufacturer Specific Attribute Changed
- *
- * @param endpoint          Endpoint that is being initialized
- * @param attributeId       Attribute that changed
- * @param manufacturerCode  Manufacturer Code of the attribute that changed
- */
-void emberAfMediaPlaybackClusterClientManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
-                                                                                   chip::AttributeId attributeId,
-                                                                                   uint16_t manufacturerCode);
-
-/** @brief Media Playback Cluster Client Message Sent
- *
- * Client Message Sent
- *
- * @param type               The type of message sent
- * @param indexOrDestination The destination or address to which the message was sent
- * @param apsFrame           The APS frame for the message
- * @param msgLen             The length of the message
- * @param message            The message that was sent
- * @param status             The status of the sent message
- */
-void emberAfMediaPlaybackClusterClientMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
-                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
-                                                          EmberStatus status);
-
-/** @brief Media Playback Cluster Client Pre Attribute Changed
- *
- * client Pre Attribute Changed
- *
- * @param endpoint      Endpoint that is being initialized
- * @param attributeId   Attribute to be changed
- * @param attributeType Attribute type
- * @param size          Attribute size
- * @param value         Attribute value
- */
-EmberAfStatus emberAfMediaPlaybackClusterClientPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
-                                                                           EmberAfAttributeType attributeType, uint8_t size,
-                                                                           uint8_t * value);
-
-/** @brief Media Playback Cluster Client Tick
- *
- * client Tick
- *
- * @param endpoint  Endpoint that is being served
- */
-void emberAfMediaPlaybackClusterClientTickCallback(chip::EndpointId endpoint);
-
-//
 // On/off Cluster client
 //
 
@@ -1292,20 +1136,6 @@ void emberAfTemperatureMeasurementClusterClientTickCallback(chip::EndpointId end
 // Cluster Commands Callback
 
 /**
- * @brief Content Launch Cluster LaunchContentResponse Command callback
- * @param contentLaunchStatus
- */
-
-bool emberAfContentLaunchClusterLaunchContentResponseCallback(uint8_t contentLaunchStatus);
-
-/**
- * @brief Content Launch Cluster LaunchURLResponse Command callback
- * @param contentLaunchStatus
- */
-
-bool emberAfContentLaunchClusterLaunchURLResponseCallback(uint8_t contentLaunchStatus);
-
-/**
  * @brief Door Lock Cluster ClearAllPinsResponse Command callback
  * @param status
  */
@@ -1566,12 +1396,6 @@ bool emberAfGroupsClusterViewGroupResponseCallback(uint8_t status, uint16_t grou
 bool emberAfIdentifyClusterIdentifyQueryResponseCallback(uint16_t timeout);
 
 /**
- * @brief Media Playback Cluster Playback Command callback
- */
-
-bool emberAfMediaPlaybackClusterPlaybackCallback();
-
-/**
  * @brief Scenes Cluster AddSceneResponse Command callback
  * @param status
  * @param groupId
index 79d1e15..775f29f 100644 (file)
                                                                                                                                    \
                                                           ZCL_SQUAWK_COMMAND_ID, "u", squawkInfo);
 
+/** @brief Command description for PlayRequest
+ *
+ * Command: PlayRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PauseRequest
+ *
+ * Command: PauseRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
+                                                                                                                                   \
+                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StopRequest
+ *
+ * Command: StopRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for StartOverRequest
+ *
+ * Command: StartOverRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
+                                                                                                                                   \
+                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for PreviousRequest
+ *
+ * Command: PreviousRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
+                                                                                                                                   \
+                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for NextRequest
+ *
+ * Command: NextRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
+                                                                                                                                   \
+                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for RewindRequest
+ *
+ * Command: RewindRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
+                                                                                                                                   \
+                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for FastForwardRequest
+ *
+ * Command: FastForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipForwardRequest
+ *
+ * Command: SkipForwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
+                                                                                                                                   \
+                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
+
+/** @brief Command description for SkipBackwardRequest
+ *
+ * Command: SkipBackwardRequest
+ */
+#define emberAfFillCommandMedia                                                                                                    \
+    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
+                                                                                                                                   \
+                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
+
 /** @brief Command description for Sleep
  *
  * Command: Sleep
                                                                                                                                    \
                                                   ZCL_SLEEP_COMMAND_ID, "", );
 
+/** @brief Command description for LaunchContent
+ *
+ * Command: LaunchContent
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
+        emberAfFillExternalBuffer(mask,                                                                                            \
+                                                                                                                                   \
+                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
+
+/** @brief Command description for LaunchURL
+ *
+ * Command: LaunchURL
+ * @param contentLaunchStatus ContentLaunchStatus
+ */
+#define emberAfFillCommandContent                                                                                                  \
+    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
+                                                                                                                                   \
+                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
+
 /** @brief Command description for MatchProtocolAddress
  *
  * Command: MatchProtocolAddress
                                                                                                                                    \
                               ZCL_UNBIND_COMMAND_ID, "uuuu", nodeId, groupId, endpointId, clusterId);
 
-/** @brief Command description for PlayRequest
- *
- * Command: PlayRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPlayRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_PLAY_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PauseRequest
- *
- * Command: PauseRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPauseRequest() emberAfFillExternalBuffer(mask,                                                                  \
-                                                                                                                                   \
-                                                            ZCL_PAUSE_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StopRequest
- *
- * Command: StopRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStopRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_STOP_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for StartOverRequest
- *
- * Command: StartOverRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterStartOverRequest() emberAfFillExternalBuffer(mask,                                                              \
-                                                                                                                                   \
-                                                                ZCL_START_OVER_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for PreviousRequest
- *
- * Command: PreviousRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterPreviousRequest() emberAfFillExternalBuffer(mask,                                                               \
-                                                                                                                                   \
-                                                               ZCL_PREVIOUS_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for NextRequest
- *
- * Command: NextRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterNextRequest() emberAfFillExternalBuffer(mask,                                                                   \
-                                                                                                                                   \
-                                                           ZCL_NEXT_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for RewindRequest
- *
- * Command: RewindRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterRewindRequest() emberAfFillExternalBuffer(mask,                                                                 \
-                                                                                                                                   \
-                                                             ZCL_REWIND_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for FastForwardRequest
- *
- * Command: FastForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterFastForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_FAST_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipForwardRequest
- *
- * Command: SkipForwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipForwardRequest() emberAfFillExternalBuffer(mask,                                                            \
-                                                                                                                                   \
-                                                                  ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for SkipBackwardRequest
- *
- * Command: SkipBackwardRequest
- */
-#define emberAfFillCommandMedia                                                                                                    \
-    PlaybackClusterSkipBackwardRequest() emberAfFillExternalBuffer(mask,                                                           \
-                                                                                                                                   \
-                                                                   ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID, "", );
-
-/** @brief Command description for LaunchContent
- *
- * Command: LaunchContent
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchContent(contentLaunchStatus)                                                                                \
-        emberAfFillExternalBuffer(mask,                                                                                            \
-                                                                                                                                   \
-                                  ZCL_LAUNCH_CONTENT_COMMAND_ID, "u", contentLaunchStatus);
-
-/** @brief Command description for LaunchURL
- *
- * Command: LaunchURL
- * @param contentLaunchStatus ContentLaunchStatus
- */
-#define emberAfFillCommandContent                                                                                                  \
-    LaunchClusterLaunchURL(contentLaunchStatus) emberAfFillExternalBuffer(mask,                                                    \
-                                                                                                                                   \
-                                                                          ZCL_LAUNCH_URL_COMMAND_ID, "u", contentLaunchStatus);
-
 /** @brief Command description for CommandOne
  *
  * Command: CommandOne
index 9e82931..499adf9 100644 (file)
 // Definitions for cluster: IAS WD
 #define ZCL_IAS_WD_CLUSTER_ID (0x0502)
 
+// Definitions for cluster: Media Playback
+#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0x0506)
+
 // Definitions for cluster: Low Power
 #define ZCL_LOW_POWER_CLUSTER_ID (0x0508)
 
+// Definitions for cluster: Content Launch
+#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0x050A)
+
 // Definitions for cluster: Application Basic
 #define ZCL_APPLICATION_BASIC_CLUSTER_ID (0x050D)
 
 // Definitions for cluster: Binding
 #define ZCL_BINDING_CLUSTER_ID (0xF000)
 
-// Definitions for cluster: Media Playback
-#define ZCL_MEDIA_PLAYBACK_CLUSTER_ID (0xF001)
-
-// Definitions for cluster: Content Launch
-#define ZCL_CONTENT_LAUNCH_CLUSTER_ID (0xF002)
-
 // Definitions for cluster: Group Key Management
 #define ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID (0xF004)
 
index 864943b..268678a 100644 (file)
 #define ZCL_START_WARNING_COMMAND_ID (0x00)
 #define ZCL_SQUAWK_COMMAND_ID (0x01)
 
+// Commands for cluster: Media Playback
+#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
+#define ZCL_PLAYBACK_COMMAND_ID (0x00)
+#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
+#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
+#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
+#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
+#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
+#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
+#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
+#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
+#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
+
 // Commands for cluster: Low Power
 #define ZCL_SLEEP_COMMAND_ID (0x00)
 
+// Commands for cluster: Content Launch
+#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
+#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
+#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
+
 // Commands for cluster: Generic Tunnel
 #define ZCL_MATCH_PROTOCOL_ADDRESS_COMMAND_ID (0x00)
 #define ZCL_MATCH_PROTOCOL_ADDRESS_RESPONSE_COMMAND_ID (0x00)
 #define ZCL_BIND_COMMAND_ID (0x00)
 #define ZCL_UNBIND_COMMAND_ID (0x01)
 
-// Commands for cluster: Media Playback
-#define ZCL_PLAY_REQUEST_COMMAND_ID (0x00)
-#define ZCL_PLAYBACK_COMMAND_ID (0x00)
-#define ZCL_PAUSE_REQUEST_COMMAND_ID (0x01)
-#define ZCL_STOP_REQUEST_COMMAND_ID (0x02)
-#define ZCL_START_OVER_REQUEST_COMMAND_ID (0x03)
-#define ZCL_PREVIOUS_REQUEST_COMMAND_ID (0x04)
-#define ZCL_NEXT_REQUEST_COMMAND_ID (0x05)
-#define ZCL_REWIND_REQUEST_COMMAND_ID (0x06)
-#define ZCL_FAST_FORWARD_REQUEST_COMMAND_ID (0x07)
-#define ZCL_SKIP_FORWARD_REQUEST_COMMAND_ID (0x08)
-#define ZCL_SKIP_BACKWARD_REQUEST_COMMAND_ID (0x09)
-
-// Commands for cluster: Content Launch
-#define ZCL_LAUNCH_CONTENT_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_CONTENT_RESPONSE_COMMAND_ID (0x00)
-#define ZCL_LAUNCH_URL_COMMAND_ID (0x01)
-#define ZCL_LAUNCH_URL_RESPONSE_COMMAND_ID (0x01)
-
 // Commands for cluster: Sample Mfg Specific Cluster
 #define ZCL_COMMAND_ONE_COMMAND_ID (0x00)
 
index 5816559..0c5f81d 100644 (file)
@@ -63,7 +63,7 @@
 
 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
 // This is an array of EmberAfAttributeMetadata structures.
-#define GENERATED_ATTRIBUTE_COUNT 16
+#define GENERATED_ATTRIBUTE_COUNT 14
 #define GENERATED_ATTRIBUTES                                                                                                       \
     {                                                                                                                              \
         { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                                 \
               ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (client): cluster revision */                                     \
             { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
               ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (client): cluster revision */                                               \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
-              ZAP_SIMPLE_DEFAULT(0x0001) }, /* Media Playback (client): cluster revision */                                        \
-            { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT),                                                             \
-              ZAP_SIMPLE_DEFAULT(0x0001) }, /* Content Launch (client): cluster revision */                                        \
     }
 
 // This is an array of EmberAfCluster structures.
 #define GENERATED_FUNCTION_ARRAYS
 
 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
-#define GENERATED_CLUSTER_COUNT 16
+#define GENERATED_CLUSTER_COUNT 14
 #define GENERATED_CLUSTERS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL }, /* Endpoint: 1, Cluster: Identify (client) */    \
             {                                                                                                                      \
                 0xF000, ZAP_ATTRIBUTE_INDEX(13), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
             }, /* Endpoint: 1, Cluster: Binding (client) */                                                                        \
-            {                                                                                                                      \
-                0xF001, ZAP_ATTRIBUTE_INDEX(14), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
-            }, /* Endpoint: 1, Cluster: Media Playback (client) */                                                                 \
-            {                                                                                                                      \
-                0xF002, ZAP_ATTRIBUTE_INDEX(15), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL                                              \
-            }, /* Endpoint: 1, Cluster: Content Launch (client) */                                                                 \
     }
 
 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
 // This is an array of EmberAfEndpointType structures.
 #define GENERATED_ENDPOINT_TYPES                                                                                                   \
     {                                                                                                                              \
-        { ZAP_CLUSTER_INDEX(0), 16, 32 },                                                                                          \
+        { ZAP_CLUSTER_INDEX(0), 14, 28 },                                                                                          \
     }
 
 // Largest attribute size is needed for various buffers
 #define ATTRIBUTE_SINGLETONS_SIZE (2)
 
 // Total size of attribute storage
-#define ATTRIBUTE_MAX_SIZE (32)
+#define ATTRIBUTE_MAX_SIZE (28)
 
 // Number of fixed endpoints
 #define FIXED_ENDPOINT_COUNT (1)
 
 // Array of EmberAfCommandMetadata structs.
 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
-#define EMBER_AF_GENERATED_COMMAND_COUNT (129)
+#define EMBER_AF_GENERATED_COMMAND_COUNT (114)
 #define GENERATED_COMMANDS                                                                                                         \
     {                                                                                                                              \
         { 0x0003, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) },     /* Identify (client): Identify */                                 \
             { 0x0508, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Low Power (client): Sleep */                                   \
             { 0xF000, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (client): Bind */                                      \
             { 0xF000, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Binding (client): Unbind */                                    \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PlayRequest */                        \
-            { 0xF001, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Media Playback (client): Playback */                           \
-            { 0xF001, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PauseRequest */                       \
-            { 0xF001, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): StopRequest */                        \
-            { 0xF001, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): StartOverRequest */                   \
-            { 0xF001, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): PreviousRequest */                    \
-            { 0xF001, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): NextRequest */                        \
-            { 0xF001, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): RewindRequest */                      \
-            { 0xF001, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): FastForwardRequest */                 \
-            { 0xF001, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): SkipForwardRequest */                 \
-            { 0xF001, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Media Playback (client): SkipBackwardRequest */                \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (client): LaunchContent */                      \
-            { 0xF002, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (client): LaunchContentResponse */              \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Content Launch (client): LaunchURL */                          \
-            { 0xF002, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Content Launch (client): LaunchURLResponse */                  \
     }
 
 // Array of EmberAfManufacturerCodeEntry structures for commands.
index ce12b68..a61e278 100644 (file)
 #define EMBER_AF_BASIC_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_BINDING_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_COLOR_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
-#define EMBER_AF_CONTENT_LAUNCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_DOOR_LOCK_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_GROUPS_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_IDENTIFY_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_LEVEL_CONTROL_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_LOW_POWER_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
-#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_SCENES_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1)
 #define ZCL_USING_COLOR_CONTROL_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_COLOR_CONTROL_CLIENT
 
-// Use this macro to check if the client side of the Content Launch cluster is included
-#define ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT
-#define EMBER_AF_PLUGIN_CONTENT_LAUNCH_CLIENT
-
 // Use this macro to check if the client side of the Door Lock cluster is included
 #define ZCL_USING_DOOR_LOCK_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_DOOR_LOCK_CLIENT
 #define ZCL_USING_LOW_POWER_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_LOW_POWER_CLIENT
 
-// Use this macro to check if the client side of the Media Playback cluster is included
-#define ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT
-#define EMBER_AF_PLUGIN_MEDIA_PLAYBACK_CLIENT
-
 // Use this macro to check if the client side of the On/off cluster is included
 #define ZCL_USING_ON_OFF_CLUSTER_CLIENT
 #define EMBER_AF_PLUGIN_ON_OFF_CLIENT
index e3207b7..5cb5a91 100644 (file)
 #define CHIP_PRINTCLUSTER_IAS_WD_CLUSTER
 #endif
 
+#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 1286, "Media Playback" },
+#else
+#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
+#endif
+
 #if defined(ZCL_USING_LOW_POWER_CLUSTER_SERVER) || defined(ZCL_USING_LOW_POWER_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER { ZCL_LOW_POWER_CLUSTER_ID, 1288, "Low Power" },
 #else
 #define CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER
 #endif
 
+#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 1290, "Content Launch" },
+#else
+#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
+#endif
+
 #if defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_SERVER) || defined(ZCL_USING_APPLICATION_BASIC_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER { ZCL_APPLICATION_BASIC_CLUSTER_ID, 1293, "Application Basic" },
 #else
 #define CHIP_PRINTCLUSTER_BINDING_CLUSTER
 #endif
 
-#if defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_SERVER) || defined(ZCL_USING_MEDIA_PLAYBACK_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER { ZCL_MEDIA_PLAYBACK_CLUSTER_ID, 61441, "Media Playback" },
-#else
-#define CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER
-#endif
-
-#if defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_SERVER) || defined(ZCL_USING_CONTENT_LAUNCH_CLUSTER_CLIENT)
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER { ZCL_CONTENT_LAUNCH_CLUSTER_ID, 61442, "Content Launch" },
-#else
-#define CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER
-#endif
-
 #if defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER) || defined(ZCL_USING_GROUP_KEY_MANAGEMENT_CLUSTER_CLIENT)
 #define CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER { ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID, 61444, "Group Key Management" },
 #else
     CHIP_PRINTCLUSTER_IAS_ZONE_CLUSTER                                                                                             \
     CHIP_PRINTCLUSTER_IAS_ACE_CLUSTER                                                                                              \
     CHIP_PRINTCLUSTER_IAS_WD_CLUSTER                                                                                               \
+    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_LOW_POWER_CLUSTER                                                                                            \
+    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_APPLICATION_BASIC_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_GENERIC_TUNNEL_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_BACNET_PROTOCOL_TUNNEL_CLUSTER                                                                               \
     CHIP_PRINTCLUSTER_DIAGNOSTICS_CLUSTER                                                                                          \
     CHIP_PRINTCLUSTER_ZLL_COMMISSIONING_CLUSTER                                                                                    \
     CHIP_PRINTCLUSTER_BINDING_CLUSTER                                                                                              \
-    CHIP_PRINTCLUSTER_MEDIA_PLAYBACK_CLUSTER                                                                                       \
-    CHIP_PRINTCLUSTER_CONTENT_LAUNCH_CLUSTER                                                                                       \
     CHIP_PRINTCLUSTER_GROUP_KEY_MANAGEMENT_CLUSTER                                                                                 \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER                                                                                  \
     CHIP_PRINTCLUSTER_SAMPLE_MFG_SPECIFIC_CLUSTER_2                                                                                \
index 06b5a71..c15546a 100644 (file)
@@ -1391,7 +1391,12 @@ void TCPEndPoint::DriveReceiving()
         // Acknowledgement is done after handling the buffers to allow the
         // application processing to throttle flow.
         uint16_t ackLength = mRcvQueue->TotalLength();
-        OnDataReceived(this, std::move(mRcvQueue));
+        INET_ERROR err     = OnDataReceived(this, std::move(mRcvQueue));
+        if (err != INET_NO_ERROR)
+        {
+            DoClose(err, false);
+            return;
+        }
         AckReceive(ackLength);
     }
 
index 2a11cce..8c6b921 100644 (file)
@@ -431,19 +431,21 @@ public:
     /**
      * @brief   Type of data reception event handling function.
      *
-     * @param[in]   endPoint    The TCP endpoint associated with the event.
-     * @param[in]   data        The data received.
+     * @param[in]   endPoint        The TCP endpoint associated with the event.
+     * @param[in]   data            The data received.
+     *
+     * @retval      INET_NO_ERROR   If the received data can be handled by higher layers.
+     * @retval      other           If the received data can not be used, and higher layers will not see it.
      *
      * @details
      *  Provide a function of this type to the \c OnDataReceived delegate
      *  member to process data reception events on \c endPoint where \c data
      *  is the message text received.
      *
-     *  A data reception event handler must acknowledge data processed using
-     *  the \c AckReceive method. The \c Free method on the data buffer must
-     *  also be invoked unless the \c PutBackReceivedData is used instead.
+     *  If this function returns an error, the connection will be closed, since higher layers
+     *  are not able to process the data for a better response.
      */
-    typedef void (*OnDataReceivedFunct)(TCPEndPoint * endPoint, chip::System::PacketBufferHandle data);
+    typedef INET_ERROR (*OnDataReceivedFunct)(TCPEndPoint * endPoint, chip::System::PacketBufferHandle data);
 
     /**
      * The endpoint's message text reception event handling function delegate.
index 41b27f1..516abc9 100644 (file)
@@ -595,7 +595,7 @@ static void HandleTCPConnectionClosed(TCPEndPoint * aEndPoint, INET_ERROR aError
 
 static void HandleTCPDataSent(TCPEndPoint * aEndPoint, uint16_t len) {}
 
-static void HandleTCPDataReceived(TCPEndPoint * aEndPoint, PacketBufferHandle aBuffer)
+static INET_ERROR HandleTCPDataReceived(TCPEndPoint * aEndPoint, PacketBufferHandle aBuffer)
 {
     const uint32_t lFirstValueReceived = sTestState.mStats.mReceive.mActual;
     const uint8_t lFirstValue          = uint8_t(lFirstValueReceived);
@@ -638,6 +638,7 @@ exit:
     {
         SetStatusFailed(sTestState.mStatus);
     }
+    return lStatus;
 }
 
 static void HandleTCPAcceptError(TCPEndPoint * aEndPoint, INET_ERROR aError)
index 1fa1612..241f4f9 100644 (file)
@@ -38,7 +38,6 @@
 #include <core/CHIPEncoding.h>
 #include <core/CHIPTLV.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace ASN1 {
index c270643..a278343 100644 (file)
@@ -37,7 +37,6 @@
 #include <core/CHIPTLV.h>
 
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 
 #include <stdint.h>
 
index 0b288fa..19d2d2e 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <core/CHIPCore.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 
index f94b9f1..a8ecb4c 100644 (file)
@@ -37,16 +37,6 @@ public:
 
     /**
      * @brief
-     *   Called when a value is returned from the storage.
-     *   This is useful for AsyncGetKeyValue() API call.
-     *
-     * @param[in] key Key for which the value is being returned
-     * @param[in] value Value or nullptr if not found.
-     */
-    virtual void OnPersistentStorageValue(const char * key, const char * value) = 0;
-
-    /**
-     * @brief
      *   Called on completion of an operation in PersistentStorageDelegate API
      *
      * @param[in] key Key for which the status is being returned
@@ -72,14 +62,6 @@ public:
 
     /**
      * @brief
-     *   Lookup the key and call delegate object with it's stringified value
-     *
-     * @param[in] key Key to lookup
-     */
-    virtual void AsyncGetKeyValue(const char * key) = 0;
-
-    /**
-     * @brief
      *   This is a synchronous Get API, where the value is returned via the output
      *   buffer. This API should be used sparingly, since it may block for
      *   some duration.
index 271d612..4999595 100644 (file)
@@ -35,7 +35,6 @@
 #include <core/CHIPTLVDebug.hpp>
 #include <core/CHIPTLVUtilities.hpp>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 namespace chip {
index d1c00fb..d4f8b01 100644 (file)
@@ -29,7 +29,6 @@
 #include <core/CHIPTLV.h>
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 
 namespace chip {
index ca1fb0f..e07da10 100644 (file)
@@ -27,7 +27,6 @@
 #include <core/CHIPEncoding.h>
 #include <core/CHIPTLV.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace TLV {
index 83f6761..4155302 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 
 #include <stdarg.h>
index 31ebbb2..35b54bc 100644 (file)
 
 #pragma once
 
+#include <cstdint>
+
 namespace chip {
 
 //
 // CHIP Vendor Identifiers (16 bits max)
 //
 
-enum ChipVendorId
+enum VendorId : uint16_t
 {
-    kChipVendor_Common       = 0x0000,
-    kChipVendor_NestLabs     = 0x235A,
-    kChipVendor_NotSpecified = 0xFFFF
+    Common       = 0x0000u,
+    NestLabs     = 0x235Au,
+    NotSpecified = 0xFFFFu
 };
 
 } // namespace chip
index 922e882..a4be34f 100644 (file)
@@ -35,7 +35,7 @@ template <class T>
 class Optional
 {
 public:
-    Optional() : mHasValue(false) {}
+    constexpr Optional() : mHasValue(false) {}
     explicit Optional(const T & value) : mValue(value), mHasValue(true) {}
 
     constexpr Optional(const Optional & other) = default;
@@ -47,7 +47,7 @@ public:
      * NOTE: Manually implemented instead of =default  since other::mValue may not be initialized
      * if it has no value.
      */
-    Optional & operator=(const Optional & other)
+    constexpr Optional & operator=(const Optional & other)
     {
         if (other.HasValue())
         {
@@ -61,14 +61,14 @@ public:
     }
 
     /** Make the optional contain a specific value */
-    void SetValue(const T & value)
+    constexpr void SetValue(const T & value)
     {
         mValue    = value;
         mHasValue = true;
     }
 
     /** Invalidate the value inside the optional. Optional now has no value */
-    void ClearValue() { mHasValue = false; }
+    constexpr void ClearValue() { mHasValue = false; }
 
     /** Gets the current value of the optional. Valid IFF `HasValue`. */
     const T & Value() const
@@ -89,7 +89,7 @@ public:
     }
 
     /** Checks if the optional contains a value or not */
-    bool HasValue() const { return mHasValue; }
+    constexpr bool HasValue() const { return mHasValue; }
 
     /** Comparison operator, handling missing values. */
     bool operator==(const Optional & other) const
index 370aa63..0fc4bbe 100644 (file)
@@ -36,7 +36,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/RandUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/ScopedBuffer.h>
 #include <support/UnitTestRegistration.h>
 
index f2f779f..8229a23 100644 (file)
@@ -20,6 +20,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
+#include "ServiceNaming.h"
 #include <mdns/minimal/ResponseSender.h>
 #include <mdns/minimal/Server.h>
 #include <mdns/minimal/core/FlatAllocatedQName.h>
@@ -30,7 +31,6 @@
 #include <mdns/minimal/responders/Txt.h>
 #include <support/CHIPMem.h>
 #include <support/RandUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/StringBuilder.h>
 
 // Enable detailed mDNS logging for received queries
@@ -402,12 +402,7 @@ CHIP_ERROR AdvertiserMinMdns::Advertise(const OperationalAdvertisingParameters &
     char uniqueName[64] = "";
 
     /// need to set server name
-    size_t len = snprintf(uniqueName, sizeof(uniqueName), "%" PRIX64 "-%" PRIX64, params.GetFabricId(), params.GetNodeId());
-    if (len >= sizeof(uniqueName))
-    {
-        ChipLogError(Discovery, "Failed to allocate QNames.");
-        return CHIP_ERROR_NO_MEMORY;
-    }
+    ReturnErrorOnFailure(MakeInstanceName(uniqueName, sizeof(uniqueName), params.GetFabricId(), params.GetNodeId()));
 
     FullQName operationalServiceName = AllocateQName("_chip", "_tcp", "local");
     FullQName operationalServerName  = AllocateQName(uniqueName, "_chip", "_tcp", "local");
index 327828e..09712d0 100644 (file)
@@ -26,7 +26,12 @@ static_library("mdns") {
     "${chip_root}/src/lib/support",
   ]
 
-  sources = [ "Advertiser.h" ]
+  sources = [
+    "Advertiser.h",
+    "Resolver.h",
+    "ServiceNaming.cpp",
+    "ServiceNaming.h",
+  ]
 
   if (chip_mdns == "none") {
     sources += [
index ab35b58..d83ded6 100644 (file)
@@ -19,9 +19,9 @@
 
 #include <inttypes.h>
 
+#include "ServiceNaming.h"
 #include "lib/core/CHIPSafeCasts.h"
 #include "lib/mdns/platform/Mdns.h"
-#include "lib/support/ReturnMacros.h"
 #include "lib/support/logging/CHIPLogging.h"
 #include "platform/CHIPDeviceConfig.h"
 #include "platform/CHIPDeviceLayer.h"
@@ -271,8 +271,8 @@ CHIP_ERROR DiscoveryImplPlatform::Advertise(const OperationalAdvertisingParamete
 
     mOperationalAdvertisingParams = params;
     // TODO: There may be multilple device/fabrid ids after multi-admin.
-    snprintf(service.mName, sizeof(service.mName), "%08X%08X-%08X%08X", (uint32_t)(params.GetNodeId() >> 32),
-             (uint32_t)(params.GetNodeId()), (uint32_t)(params.GetFabricId() >> 32), (uint32_t)(params.GetFabricId()));
+
+    ReturnErrorOnFailure(MakeInstanceName(service.mName, sizeof(service.mName), params.GetFabricId(), params.GetNodeId()));
     strncpy(service.mType, "_chip", sizeof(service.mType));
     service.mProtocol      = MdnsServiceProtocol::kMdnsProtocolTcp;
     service.mPort          = CHIP_PORT;
@@ -305,7 +305,7 @@ CHIP_ERROR DiscoveryImplPlatform::ResolveNodeId(uint64_t nodeId, uint64_t fabric
 
     MdnsService service;
 
-    snprintf(service.mName, sizeof(service.mName), "%" PRIX64 "-%" PRIX64, nodeId, fabricId);
+    ReturnErrorOnFailure(MakeInstanceName(service.mName, sizeof(service.mName), fabricId, nodeId));
     strncpy(service.mType, "_chip", sizeof(service.mType));
     service.mProtocol    = MdnsServiceProtocol::kMdnsProtocolTcp;
     service.mAddressType = type;
diff --git a/src/lib/mdns/ServiceNaming.cpp b/src/lib/mdns/ServiceNaming.cpp
new file mode 100644 (file)
index 0000000..fbe64ea
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "ServiceNaming.h"
+
+#include <support/CodeUtils.h>
+
+#include <cstdio>
+#include <inttypes.h>
+
+namespace chip {
+namespace Mdns {
+
+CHIP_ERROR MakeInstanceName(char * buffer, size_t bufferLen, uint64_t fabricId, uint64_t nodeId)
+{
+    constexpr size_t kServiceNameLen = 16 + 1 + 16; // 2 * 64-bit value in HEX + hyphen
+
+    ReturnErrorCodeIf(bufferLen <= kServiceNameLen, CHIP_ERROR_BUFFER_TOO_SMALL);
+
+    snprintf(buffer, bufferLen, "%08" PRIX32 "%08" PRIX32 "-%08" PRIX32 "%08" PRIX32, static_cast<uint32_t>(fabricId >> 32),
+             static_cast<uint32_t>(fabricId), static_cast<uint32_t>(nodeId >> 32), static_cast<uint32_t>(nodeId));
+
+    return CHIP_NO_ERROR;
+}
+
+} // namespace Mdns
+} // namespace chip
diff --git a/src/lib/mdns/ServiceNaming.h b/src/lib/mdns/ServiceNaming.h
new file mode 100644 (file)
index 0000000..291daf1
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#pragma once
+
+#include <core/CHIPError.h>
+
+#include <cstddef>
+#include <cstdint>
+
+namespace chip {
+namespace Mdns {
+
+CHIP_ERROR MakeInstanceName(char * buffer, size_t bufferLen, uint64_t fabricId, uint64_t nodeId);
+
+} // namespace Mdns
+} // namespace chip
index 94dde15..51596fc 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "QueryReplyFilter.h"
 
-#include <support/ReturnMacros.h>
 #include <system/SystemClock.h>
 
 #define RETURN_IF_ERROR(err)                                                                                                       \
index 810196e..c6432df 100644 (file)
@@ -21,7 +21,6 @@
 #include <utility>
 
 #include <mdns/minimal/core/DnsHeader.h>
-#include <support/ReturnMacros.h>
 
 namespace mdns {
 namespace Minimal {
index 20010d9..9ba5e5c 100644 (file)
@@ -79,9 +79,10 @@ static_library("support") {
     "PersistedCounter.h",
     "Pool.cpp",
     "Pool.h",
+    "PrivateHeap.cpp",
+    "PrivateHeap.h",
     "RandUtils.cpp",
     "RandUtils.h",
-    "ReturnMacros.h",
     "SafeInt.h",
     "SerializableIntegerSet.cpp",
     "SerializableIntegerSet.h",
index fb99ed9..8de9fb1 100644 (file)
@@ -46,7 +46,7 @@ public:
     static_assert(sizeof(StorageType) >= sizeof(FlagsEnum), "All flags should fit in the storage type");
     using IntegerType = StorageType;
 
-    BitFlags() : mValue(0) {}
+    constexpr BitFlags() : mValue(0) {}
     BitFlags(const BitFlags & other) = default;
     BitFlags & operator=(const BitFlags &) = default;
 
@@ -81,7 +81,7 @@ public:
      *
      * @param flag      Typed flag(s) to set. Any flags not in @a v are unaffected.
      */
-    BitFlags & Set(FlagsEnum flag)
+    constexpr BitFlags & Set(FlagsEnum flag)
     {
         mValue |= static_cast<IntegerType>(flag);
         return *this;
@@ -93,7 +93,7 @@ public:
      * @param flag      Typed flag(s) to set or clear. Any flags not in @a flag are unaffected.
      * @param isSet     If true, set the flag; if false, clear it.
      */
-    BitFlags & Set(FlagsEnum flag, bool isSet) { return isSet ? Set(flag) : Clear(flag); }
+    constexpr BitFlags & Set(FlagsEnum flag, bool isSet) { return isSet ? Set(flag) : Clear(flag); }
 
     /**
      * Clear flag(s).
@@ -111,7 +111,7 @@ public:
      *
      * @param flag  Typed flag(s) to clear. Any flags not in @a flag are unaffected.
      */
-    BitFlags & Clear(FlagsEnum flag)
+    constexpr BitFlags & Clear(FlagsEnum flag)
     {
         mValue &= static_cast<IntegerType>(~static_cast<IntegerType>(flag));
         return *this;
index 5e66003..9e198bc 100644 (file)
@@ -157,6 +157,128 @@ constexpr inline const _T & max(const _T & a, const _T & b)
 #define IgnoreUnusedVariable(aVariable) ((void) (aVariable))
 
 /**
+ *  @def ReturnErrorOnFailure(expr)
+ *
+ *  @brief
+ *    Returns the error code if the expression returns something different
+ *    than CHIP_NO_ERROR.
+ *
+ *  Example usage:
+ *
+ *  @code
+ *    ReturnErrorOnFailure(channel->SendMsg(msg));
+ *  @endcode
+ *
+ *  @param[in]  expr        A scalar expression to be evaluated against CHIP_NO_ERROR.
+ */
+#define ReturnErrorOnFailure(expr)                                                                                                 \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        CHIP_ERROR __err = (expr);                                                                                                 \
+        if (__err != CHIP_NO_ERROR)                                                                                                \
+        {                                                                                                                          \
+            return __err;                                                                                                          \
+        }                                                                                                                          \
+    } while (false)
+
+/**
+ *  @def ReturnOnFailure(expr)
+ *
+ *  @brief
+ *    Returns if the expression returns something different than CHIP_NO_ERROR
+ *
+ *  Example usage:
+ *
+ *  @code
+ *    ReturnOnFailure(channel->SendMsg(msg));
+ *  @endcode
+ *
+ *  @param[in]  expr        A scalar expression to be evaluated against CHIP_NO_ERROR.
+ */
+#define ReturnOnFailure(expr)                                                                                                      \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        CHIP_ERROR __err = (expr);                                                                                                 \
+        if (__err != CHIP_NO_ERROR)                                                                                                \
+        {                                                                                                                          \
+            return;                                                                                                                \
+        }                                                                                                                          \
+    } while (false)
+
+/**
+ *  @def VerifyOrReturn(expr, ...)
+ *
+ *  @brief
+ *    Returns from the void function if expression evaluates to false
+ *
+ *  Example usage:
+ *
+ * @code
+ *    VerifyOrReturn(param != nullptr, LogError("param is nullptr"));
+ *  @endcode
+ *
+ *  @param[in]  expr        A Boolean expression to be evaluated.
+ */
+#define VerifyOrReturn(expr, ...)                                                                                                  \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        if (!(expr))                                                                                                               \
+        {                                                                                                                          \
+            __VA_ARGS__;                                                                                                           \
+            return;                                                                                                                \
+        }                                                                                                                          \
+    } while (false)
+
+/**
+ *  @def VerifyOrReturnError(expr, code)
+ *
+ *  @brief
+ *    Returns a specified error code if expression evaluates to false
+ *
+ *  Example usage:
+ *
+ *  @code
+ *    VerifyOrReturnError(param != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+ *  @endcode
+ *
+ *  @param[in]  expr        A Boolean expression to be evaluated.
+ *  @param[in]  code        A value to return if @a expr is false.
+ */
+#define VerifyOrReturnError(expr, code)                                                                                            \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        if (!(expr))                                                                                                               \
+        {                                                                                                                          \
+            return code;                                                                                                           \
+        }                                                                                                                          \
+    } while (false)
+
+/**
+ *  @def ReturnErrorCodeIf(expr, code)
+ *
+ *  @brief
+ *    Returns a specified error code if expression evaluates to true
+ *
+ *  Example usage:
+ *
+ *  @code
+ *    ReturnErrorCodeIf(state == kInitialized, CHIP_NO_ERROR);
+ *    ReturnErrorCodeIf(state == kInitialized, CHIP_ERROR_INVALID_STATE);
+ *  @endcode
+ *
+ *  @param[in]  expr        A Boolean expression to be evaluated.
+ *  @param[in]  code        A value to return if @a expr is false.
+ */
+#define ReturnErrorCodeIf(expr, code)                                                                                              \
+    do                                                                                                                             \
+    {                                                                                                                              \
+        if (expr)                                                                                                                  \
+        {                                                                                                                          \
+            return code;                                                                                                           \
+        }                                                                                                                          \
+    } while (false)
+
+/**
  *  @def SuccessOrExit(aStatus)
  *
  *  @brief
diff --git a/src/lib/support/PrivateHeap.cpp b/src/lib/support/PrivateHeap.cpp
new file mode 100644 (file)
index 0000000..e906792
--- /dev/null
@@ -0,0 +1,283 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    Copyright 2019 Google Inc. All Rights Reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "PrivateHeap.h"
+
+#include <support/CodeUtils.h>
+#include <support/logging/CHIPLogging.h>
+
+namespace {
+
+constexpr uint32_t kInvalidHeapBlockSize = 0xFFFFFFFF;
+constexpr int32_t kHeapBlockInUse        = 0x01;
+constexpr int32_t kHeapBlockFree         = 0x10;
+constexpr int32_t kInvalidHeaderState    = 0xff;
+
+using internal::PrivateHeapBlockHeader;
+
+// this makes life easier, no need to add align offsets.
+static_assert(sizeof(PrivateHeapBlockHeader) % kPrivateHeapAllocationAlignment == 0, "Invalid block size.");
+
+uint32_t ComputeHeapBlockChecksum(const PrivateHeapBlockHeader * header)
+{
+    uint32_t checksum = header->prevBytes;
+    checksum *= 31;
+    checksum += header->nextBytes;
+    checksum *= 31;
+    checksum += header->state;
+    return checksum;
+}
+
+// Advances the heap block to the next value
+PrivateHeapBlockHeader * NextHeader(PrivateHeapBlockHeader * start)
+{
+    if (start->nextBytes == kInvalidHeapBlockSize)
+    {
+        return nullptr;
+    }
+
+    if (start->checksum != ComputeHeapBlockChecksum(start))
+    {
+        ChipLogError(Support, "Corrupted heap: checksum is invalid");
+        chipDie();
+    }
+
+    return reinterpret_cast<PrivateHeapBlockHeader *>(reinterpret_cast<char *>(start) + sizeof(PrivateHeapBlockHeader) +
+                                                      start->nextBytes);
+}
+
+// Advances the heap block to the previous value
+PrivateHeapBlockHeader * PreviousHeader(PrivateHeapBlockHeader * start)
+{
+    if (start->prevBytes == kInvalidHeapBlockSize)
+    {
+        return nullptr;
+    }
+
+    if (start->checksum != ComputeHeapBlockChecksum(start))
+    {
+        ChipLogError(Support, "Corrupted heap: checksum is invalid");
+        chipDie();
+    }
+
+    return reinterpret_cast<PrivateHeapBlockHeader *>(reinterpret_cast<char *>(start) - sizeof(PrivateHeapBlockHeader) -
+                                                      start->prevBytes);
+}
+
+void ValidateHeader(const PrivateHeapBlockHeader * header)
+{
+    if (header->state != kHeapBlockFree && header->state != kHeapBlockInUse)
+    {
+        ChipLogError(Support, "Invalid header state (neither free nor in use) at %p", header);
+        chipDie();
+    }
+
+    if (header->checksum != ComputeHeapBlockChecksum(header))
+    {
+        ChipLogError(Support, "Corrupted heap: checksum is invalid at %p", header);
+        chipDie();
+    }
+}
+
+} // namespace
+
+extern "C" void PrivateHeapInit(void * heap, size_t size)
+{
+    if (heap == nullptr)
+    {
+        ChipLogError(Support, "Cannot initialize null heap");
+        chipDie();
+    }
+
+    if (size < 2 * sizeof(PrivateHeapBlockHeader))
+    {
+        ChipLogError(Support, "Insufficient space in private heap");
+        chipDie();
+    }
+
+    if (reinterpret_cast<uintptr_t>(heap) % kPrivateHeapAllocationAlignment != 0)
+    {
+        ChipLogError(Support, "Invalid alignment for private heap initialization");
+        chipDie();
+    }
+
+    PrivateHeapBlockHeader * header = reinterpret_cast<PrivateHeapBlockHeader *>(heap);
+
+    header->prevBytes = kInvalidHeapBlockSize;
+    header->nextBytes = static_cast<uint32_t>(size - 2 * sizeof(PrivateHeapBlockHeader));
+    header->state     = kHeapBlockFree;
+    header->checksum  = ComputeHeapBlockChecksum(header);
+
+    header            = NextHeader(header);
+    header->nextBytes = kInvalidHeapBlockSize;
+    header->prevBytes = static_cast<uint32_t>(size - 2 * sizeof(PrivateHeapBlockHeader));
+    header->state     = kHeapBlockFree; // does not matter really
+    header->checksum  = ComputeHeapBlockChecksum(header);
+}
+
+extern "C" void * PrivateHeapAlloc(void * heap, size_t size)
+{
+    PrivateHeapBlockHeader * header = reinterpret_cast<PrivateHeapBlockHeader *>(heap);
+
+    // we allocate aligned, no matter what
+    if (size % kPrivateHeapAllocationAlignment != 0)
+    {
+        size += kPrivateHeapAllocationAlignment - (size % kPrivateHeapAllocationAlignment);
+    }
+
+    for (; header != nullptr; header = NextHeader(header))
+    {
+        ValidateHeader(header);
+
+        if (header->nextBytes == kInvalidHeapBlockSize)
+        {
+            continue;
+        }
+
+        if (header->state != kHeapBlockFree)
+        {
+            continue; // not free
+        }
+
+        if (header->nextBytes < size)
+        {
+            continue; // insufficient space
+        }
+
+        if (header->nextBytes - size < sizeof(PrivateHeapBlockHeader) + kPrivateHeapAllocationAlignment)
+        {
+            // allocate the entire block
+            header->state    = kHeapBlockInUse;
+            header->checksum = ComputeHeapBlockChecksum(header);
+        }
+        else
+        {
+            // splits the block into two
+            //
+            // +--------+       +--------+       +------+
+            // | header |  ---> | middle |  ---> | next |
+            // +--------+       +--------+       +------+
+            //
+            PrivateHeapBlockHeader * next = NextHeader(header);
+            PrivateHeapBlockHeader * middle =
+                reinterpret_cast<PrivateHeapBlockHeader *>(reinterpret_cast<char *>(header + 1) + size);
+
+            // middle is a new block
+            middle->nextBytes = static_cast<uint32_t>(header->nextBytes - size - sizeof(PrivateHeapBlockHeader));
+            middle->prevBytes = static_cast<uint32_t>(size);
+            middle->state     = kHeapBlockFree;
+            middle->checksum  = ComputeHeapBlockChecksum(middle);
+
+            // fix up the header
+            header->nextBytes = static_cast<uint32_t>(size);
+            header->state     = kHeapBlockInUse;
+            header->checksum  = ComputeHeapBlockChecksum(header);
+
+            // fix up the final block
+            if (next != nullptr)
+            {
+                next->prevBytes = middle->nextBytes;
+                next->checksum  = ComputeHeapBlockChecksum(next);
+            }
+        }
+
+        // we can now use the header
+        return header + 1; // data right after the header
+    }
+
+    // no space found
+    return nullptr;
+}
+
+extern "C" void PrivateHeapFree(void * ptr)
+{
+    if (ptr == nullptr)
+    {
+        // freeing NULL pointers is always acceptable and a noop
+        return;
+    }
+
+    PrivateHeapBlockHeader * header =
+        reinterpret_cast<PrivateHeapBlockHeader *>(static_cast<char *>(ptr) - sizeof(PrivateHeapBlockHeader));
+
+    ValidateHeader(header);
+    header->state    = kHeapBlockFree;
+    header->checksum = ComputeHeapBlockChecksum(header);
+
+    // Merge with previous
+    //
+    // +-------+                          +--------+
+    // | other |  ----- nextBytes ----->  | header |
+    // +-------+                          +--------+
+    //
+    PrivateHeapBlockHeader * other = PreviousHeader(header);
+    if (other != nullptr && other->state == kHeapBlockFree && other->nextBytes != kInvalidHeapBlockSize)
+    {
+        // includes the free bytes in this block in the previous
+        other->nextBytes += static_cast<uint32_t>(header->nextBytes + sizeof(PrivateHeapBlockHeader));
+        other->checksum = ComputeHeapBlockChecksum(other);
+        header->state   = kInvalidHeaderState;
+        header          = other;
+
+        // fixes up the next block
+        other = NextHeader(header);
+        if (other != nullptr)
+        {
+            other->prevBytes = header->nextBytes;
+            other->checksum  = ComputeHeapBlockChecksum(other);
+        }
+    }
+
+    // Merge with next
+    //
+    // +--------+                          +-------+
+    // | header |  ----- nextBytes ----->  | other |
+    // +--------+                          +-------+
+    //
+    other = NextHeader(header);
+    if (other != nullptr && other->state == kHeapBlockFree && other->nextBytes != kInvalidHeapBlockSize)
+    {
+        // includes the free bytes in the next block
+        other->state = kInvalidHeaderState;
+        header->nextBytes += static_cast<uint32_t>(other->nextBytes + sizeof(PrivateHeapBlockHeader));
+        header->checksum = ComputeHeapBlockChecksum(header);
+
+        // fixes up the next block
+        other = NextHeader(header);
+        if (other != nullptr)
+        {
+            other->prevBytes = header->nextBytes;
+            other->checksum  = ComputeHeapBlockChecksum(other);
+        }
+    }
+}
+
+extern "C" void PrivateHeapDump(void * top)
+{
+    PrivateHeapBlockHeader * header = reinterpret_cast<PrivateHeapBlockHeader *>(top);
+
+    ChipLogProgress(Support, "========= HEAP ===========");
+    while (header->nextBytes != kInvalidHeapBlockSize)
+    {
+        intptr_t offset = reinterpret_cast<char *>(header) - reinterpret_cast<char *>(top);
+        ChipLogProgress(Support, "    %ld: size: %d, state: %d", static_cast<long>(offset), static_cast<int>(header->nextBytes),
+                        static_cast<int>(header->state));
+
+        header = NextHeader(header);
+    }
+}
diff --git a/src/lib/support/PrivateHeap.h b/src/lib/support/PrivateHeap.h
new file mode 100644 (file)
index 0000000..e62c64b
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    Copyright 2019 Google Inc. All Rights Reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#pragma once
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <cstddef>
+#include <type_traits>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+// Initializes the heap (set start and end blocks)
+void PrivateHeapInit(void * heap, size_t size);
+
+// Allocates a new block on the specified heap
+void * PrivateHeapAlloc(void * heap, size_t size);
+
+// Marks the specified block as free
+void PrivateHeapFree(void * ptr);
+
+void PrivateHeapDump(void * ptr);
+
+#ifdef __cplusplus
+} // extern "C"
+
+namespace internal {
+
+// Heap structure, exposed for tests
+//
+//  +---------+---------+-----+                      +---------+-----------+
+//  | prev: 0 | next: n | ... |  ....<n_bytes> ....  | prev: n | next: ... |
+//  +---------+---------+-----+                      +---------+-----------+
+//
+struct PrivateHeapBlockHeader
+{
+    uint32_t prevBytes;
+    uint32_t nextBytes;
+    uint32_t state;
+    uint32_t checksum; // super-basic attempt to detect errors
+};
+
+} // namespace internal
+
+constexpr size_t kPrivateHeapAllocationAlignment = std::alignment_of<max_align_t>::value;
+
+#endif // ifdef __cplusplus
diff --git a/src/lib/support/ReturnMacros.h b/src/lib/support/ReturnMacros.h
deleted file mode 100644 (file)
index 8ab58f7..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- *    Copyright (c) 2020 Project CHIP Authors
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#pragma once
-
-#include <core/CHIPError.h>
-
-/// Returns the error code if the expression returns something different
-/// than CHIP_NO_ERROR
-///
-/// Use like:
-///   ReturnErrorOnFailure(channel->SendMsg(msg));
-#define ReturnErrorOnFailure(expr)                                                                                                 \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        CHIP_ERROR __err = (expr);                                                                                                 \
-        if (__err != CHIP_NO_ERROR)                                                                                                \
-        {                                                                                                                          \
-            return __err;                                                                                                          \
-        }                                                                                                                          \
-    } while (false)
-
-/// Returns if the expression returns something different than CHIP_NO_ERROR
-///
-/// Use like:
-///   ReturnOnFailure(channel->SendMsg(msg));
-#define ReturnOnFailure(expr)                                                                                                      \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        CHIP_ERROR __err = (expr);                                                                                                 \
-        if (__err != CHIP_NO_ERROR)                                                                                                \
-        {                                                                                                                          \
-            return;                                                                                                                \
-        }                                                                                                                          \
-    } while (false)
-
-/// Returns from the void function if expression evaluates to false
-///
-/// Use like:
-///   VerifyOrReturn(param != nullptr, LogError("param is nullptr"));
-#define VerifyOrReturn(expr, ...)                                                                                                  \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        if (!(expr))                                                                                                               \
-        {                                                                                                                          \
-            __VA_ARGS__;                                                                                                           \
-            return;                                                                                                                \
-        }                                                                                                                          \
-    } while (false)
-
-/// Returns a specified error code if expression evaluates to false
-///
-/// Use like:
-///   VerifyOrReturnError(param != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
-#define VerifyOrReturnError(expr, code)                                                                                            \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        if (!(expr))                                                                                                               \
-        {                                                                                                                          \
-            return code;                                                                                                           \
-        }                                                                                                                          \
-    } while (false)
-
-/// Returns a specified error code if expression evaluates to true
-///
-/// Use like:
-///   ReturnErrorCodeIf(state == kInitialized, CHIP_NO_ERROR);
-///   ReturnErrorCodeIf(state == kInitialized, CHIP_ERROR_INVALID_STATE);
-#define ReturnErrorCodeIf(expr, code)                                                                                              \
-    do                                                                                                                             \
-    {                                                                                                                              \
-        if (expr)                                                                                                                  \
-        {                                                                                                                          \
-            return code;                                                                                                           \
-        }                                                                                                                          \
-    } while (false)
index 5f19189..6e872a3 100644 (file)
@@ -30,6 +30,7 @@ chip_test_suite("tests") {
     "TestCHIPMem.cpp",
     "TestErrorStr.cpp",
     "TestPool.cpp",
+    "TestPrivateHeap.cpp",
     "TestSafeInt.cpp",
     "TestSafeString.cpp",
     "TestScopedBuffer.cpp",
diff --git a/src/lib/support/tests/TestPrivateHeap.cpp b/src/lib/support/tests/TestPrivateHeap.cpp
new file mode 100644 (file)
index 0000000..75aec86
--- /dev/null
@@ -0,0 +1,288 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    Copyright 2019 Google Inc. All Rights Reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <support/PrivateHeap.h>
+#include <support/UnitTestRegistration.h>
+
+#include <string.h>
+
+#include <nlunit-test.h>
+
+namespace {
+
+constexpr size_t kBlockHeaderSize = sizeof(internal::PrivateHeapBlockHeader);
+
+// Splitting block tests assume we know the size
+static_assert(kBlockHeaderSize == 16, "Test assumes block size of 16");
+
+// helper class for allocating things
+template <size_t kSize>
+class PrivateHeapAllocator
+{
+public:
+    PrivateHeapAllocator() { PrivateHeapInit(mHeap.buffer, kSize); }
+    void * HeapAlloc(size_t size) { return PrivateHeapAlloc(mHeap.buffer, size); }
+    void HeapFree(void * buffer) { PrivateHeapFree(buffer); }
+
+private:
+    struct alignas(kPrivateHeapAllocationAlignment)
+    {
+        uint8_t buffer[kSize];
+    } mHeap;
+};
+
+void SingleHeapAllocAndFree(nlTestSuite * inSuite, void * inContext)
+{
+    PrivateHeapAllocator<16 + 2 * kBlockHeaderSize> allocator;
+
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17)); // insufficient size
+    void * ptr = allocator.HeapAlloc(16);
+    NL_TEST_ASSERT(inSuite, nullptr != ptr);
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); // insufficient size
+    memset(ptr, 0xab, 16);
+    allocator.HeapFree(ptr);
+
+    // allocate different sizes on this heap, see how that goes
+    for (size_t i = 1; i < 17; ++i)
+    {
+        ptr = allocator.HeapAlloc(i);
+        NL_TEST_ASSERT(inSuite, nullptr != ptr);
+        NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17 - i)); // insufficient size
+        allocator.HeapFree(ptr);
+    }
+}
+
+void SplitHeapAllocAndFree(nlTestSuite * inSuite, void * inContext)
+{
+    PrivateHeapAllocator<128> allocator;
+    // allocator state:
+    // <HDR-FREE> 96 <HDR-END>
+
+    void * p1 = allocator.HeapAlloc(30);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    // allocator state:
+    // <HDR-IN_USE> 32 <HRD-FREE> 48 <HDR-END>
+
+    void * p2 = allocator.HeapAlloc(4);
+    NL_TEST_ASSERT(inSuite, nullptr != p2);
+    // allocator state:
+    // <HDR-IN_USE> 32 <HRD-IN_USE> 8 <HDR-FREE> 24 <HDR-END>
+
+    allocator.HeapFree(p1);
+    // allocator state:
+    // <HDR-FREE> 32 <HRD-IN_USE> 8 <HDR-FREE> 24 <HDR-END>
+
+    allocator.HeapFree(p2);
+    // allocator state:
+    // <HDR-FREE> 96 <HDR-END>
+
+    p1 = allocator.HeapAlloc(90);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    allocator.HeapFree(p1);
+}
+
+void FreeMergeNext(nlTestSuite * inSuite, void * inContext)
+{
+    PrivateHeapAllocator<5 * 16> allocator;
+
+    void * p1 = allocator.HeapAlloc(16);
+    void * p2 = allocator.HeapAlloc(16);
+
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    NL_TEST_ASSERT(inSuite, nullptr != p2);
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1));
+
+    memset(p1, 0xab, 16);
+    memset(p2, 0xcd, 16);
+
+    // freeing 1,2 should clear space
+    allocator.HeapFree(p1);
+    allocator.HeapFree(p2);
+
+    p1 = allocator.HeapAlloc(3 * 16);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    allocator.HeapFree(p1);
+}
+
+void FreeMergePrevious(nlTestSuite * inSuite, void * inContext)
+{
+    PrivateHeapAllocator<5 * 16> allocator;
+
+    void * p1 = allocator.HeapAlloc(16);
+    void * p2 = allocator.HeapAlloc(16);
+
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    NL_TEST_ASSERT(inSuite, nullptr != p2);
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1));
+
+    memset(p1, 0xab, 16);
+    memset(p2, 0xcd, 16);
+
+    // freeing 2,1 should clear space
+    allocator.HeapFree(p2);
+    allocator.HeapFree(p1);
+    p1 = allocator.HeapAlloc(3 * 16);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    allocator.HeapFree(p1);
+}
+
+void FreeMergePreviousAndNext(nlTestSuite * inSuite, void * inContext)
+{
+
+    PrivateHeapAllocator<7 * 16> allocator;
+
+    void * p1 = allocator.HeapAlloc(16);
+    void * p2 = allocator.HeapAlloc(16);
+    void * p3 = allocator.HeapAlloc(16);
+
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    NL_TEST_ASSERT(inSuite, nullptr != p2);
+    NL_TEST_ASSERT(inSuite, nullptr != p3);
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1));
+
+    memset(p1, 0xab, 16);
+    memset(p2, 0xcd, 16);
+    memset(p3, 0xef, 16);
+
+    allocator.HeapFree(p1);
+    allocator.HeapFree(p3);
+    // we have 2 slots of size 16 available now
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17));
+
+    // Freeing p2 makes enoug space
+    allocator.HeapFree(p2);
+    p1 = allocator.HeapAlloc(5 * 16);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    allocator.HeapFree(p1);
+}
+
+void MultipleMerge(nlTestSuite * inSuite, void * inContext)
+{
+    PrivateHeapAllocator<32 * kBlockHeaderSize> allocator;
+
+    // 31 blocks available for alloc
+    void * p1 = allocator.HeapAlloc(2 * kBlockHeaderSize); // uses up 3 blocks
+    void * p2 = allocator.HeapAlloc(5 * kBlockHeaderSize); // uses up 6 blocks
+    void * p3 = allocator.HeapAlloc(8 * kBlockHeaderSize); // uses up 9 blocks
+    void * p4 = allocator.HeapAlloc(1 * kBlockHeaderSize); // uses up 2 blocks
+    void * p5 = allocator.HeapAlloc(7 * kBlockHeaderSize); // uses up 8 blocks
+    void * p6 = allocator.HeapAlloc(2 * kBlockHeaderSize); // uses up 2 (last given)
+
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    NL_TEST_ASSERT(inSuite, nullptr != p2);
+    NL_TEST_ASSERT(inSuite, nullptr != p3);
+    NL_TEST_ASSERT(inSuite, nullptr != p4);
+    NL_TEST_ASSERT(inSuite, nullptr != p5);
+    NL_TEST_ASSERT(inSuite, nullptr != p6);
+
+    allocator.HeapFree(p3);
+    allocator.HeapFree(p4);
+    // 10 blocks available (9 from p3 without HDR and 2 from p4 + HDR)
+    p3 = allocator.HeapAlloc(10 * kBlockHeaderSize);
+    NL_TEST_ASSERT(inSuite, nullptr != p3);
+    NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); // full
+
+    allocator.HeapFree(p6);
+    allocator.HeapFree(p5);
+    allocator.HeapFree(p3);
+    allocator.HeapFree(p2);
+    allocator.HeapFree(p1);
+
+    p1 = allocator.HeapAlloc(30 * kBlockHeaderSize);
+    NL_TEST_ASSERT(inSuite, nullptr != p1);
+    allocator.HeapFree(p1);
+}
+
+void ForwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext)
+{
+    constexpr int kNumBlocks = 16;
+    PrivateHeapAllocator<(2 * kNumBlocks + 1) * kBlockHeaderSize> allocator;
+    void * ptrs[kNumBlocks];
+
+    for (int i = 0; i < kNumBlocks; ++i)
+    {
+        ptrs[i] = allocator.HeapAlloc(kBlockHeaderSize);
+        NL_TEST_ASSERT(inSuite, nullptr != ptrs[i]);
+        memset(ptrs[i], 0xab, kBlockHeaderSize);
+    }
+
+    // heap looks like:
+    ///  |HDR| 16 |HDR| 16 |HDR| ..... |HDR| 16 |HDR|
+
+    // free each block from the start and re-allocate into a bigger block
+    for (size_t i = 1; i < kNumBlocks; ++i)
+    {
+        allocator.HeapFree(ptrs[0]);
+        allocator.HeapFree(ptrs[i]);
+
+        ptrs[0] = allocator.HeapAlloc((1 + 2 * i) * kBlockHeaderSize);
+        NL_TEST_ASSERT(inSuite, nullptr != ptrs[0]);
+    }
+    allocator.HeapFree(ptrs[0]);
+}
+
+void BackwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext)
+{
+    constexpr int kNumBlocks = 16;
+    PrivateHeapAllocator<(2 * kNumBlocks + 1) * kBlockHeaderSize> allocator;
+    void * ptrs[kNumBlocks];
+
+    for (int i = 0; i < kNumBlocks; ++i)
+    {
+        ptrs[i] = allocator.HeapAlloc(kBlockHeaderSize);
+        NL_TEST_ASSERT(inSuite, nullptr != ptrs[i]);
+        memset(ptrs[i], 0xab, kBlockHeaderSize);
+    }
+
+    // heap looks like:
+    ///  |HDR| 16 |HDR| 16 |HDR| ..... |HDR| 16 |HDR|
+
+    // free each block from the send and re-allocate into a bigger block
+    for (size_t i = 1; i < kNumBlocks; ++i)
+    {
+        allocator.HeapFree(ptrs[kNumBlocks - 1]);
+        allocator.HeapFree(ptrs[kNumBlocks - i - 1]);
+
+        ptrs[kNumBlocks - 1] = allocator.HeapAlloc((1 + 2 * i) * kBlockHeaderSize);
+        NL_TEST_ASSERT(inSuite, nullptr != ptrs[kNumBlocks - 1]);
+    }
+    allocator.HeapFree(ptrs[kNumBlocks - 1]);
+}
+
+const nlTest sTests[] = {
+    NL_TEST_DEF("SingleHeapAllocAndFree", SingleHeapAllocAndFree),     //
+    NL_TEST_DEF("SplitHeapAllocAndFree", SplitHeapAllocAndFree),       //
+    NL_TEST_DEF("FreeMergeNext", FreeMergeNext),                       //
+    NL_TEST_DEF("FreeMergePrevious", FreeMergePrevious),               //
+    NL_TEST_DEF("FreeMergePreviousAndNext", FreeMergePreviousAndNext), //
+    NL_TEST_DEF("MultipleMerge", MultipleMerge),                       //
+    NL_TEST_DEF("ForwardFreeAndRealloc", ForwardFreeAndRealloc),       //
+    NL_TEST_DEF("BackwardFreeAndRealloc", BackwardFreeAndRealloc),     //
+    NL_TEST_SENTINEL()                                                 //
+};
+
+} // namespace
+
+int TestPrivateHeap(void)
+{
+    nlTestSuite theSuite = { "PrivateHeap", sTests, nullptr, nullptr };
+    nlTestRunner(&theSuite, nullptr);
+    return nlTestRunnerStats(&theSuite);
+}
+
+CHIP_REGISTER_TEST_SUITE(TestPrivateHeap)
index ce34db7..358485c 100644 (file)
@@ -18,7 +18,6 @@
 #pragma once
 
 #include <app/util/basic-types.h>
-#include <support/ReturnMacros.h>
 #include <transport/AdminPairingTable.h>
 
 namespace chip {
index a384bb6..f58b148 100644 (file)
@@ -76,7 +76,7 @@ void ExchangeContext::SetResponseTimeout(Timeout timeout)
     mResponseTimeout = timeout;
 }
 
-CHIP_ERROR ExchangeContext::SendMessage(uint16_t protocolId, uint8_t msgType, PacketBufferHandle msgBuf,
+CHIP_ERROR ExchangeContext::SendMessage(Protocols::Id protocolId, uint8_t msgType, PacketBufferHandle msgBuf,
                                         const SendFlags & sendFlags)
 {
     CHIP_ERROR err                         = CHIP_NO_ERROR;
@@ -111,7 +111,7 @@ CHIP_ERROR ExchangeContext::SendMessage(uint16_t protocolId, uint8_t msgType, Pa
     return err;
 }
 
-CHIP_ERROR ExchangeContext::SendMessageImpl(uint16_t protocolId, uint8_t msgType, PacketBufferHandle msgBuf,
+CHIP_ERROR ExchangeContext::SendMessageImpl(Protocols::Id protocolId, uint8_t msgType, PacketBufferHandle msgBuf,
                                             const SendFlags & sendFlags, Transport::PeerConnectionState * state)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
index 35e33d4..0042c9a 100644 (file)
@@ -28,6 +28,7 @@
 #include <messaging/ExchangeDelegate.h>
 #include <messaging/Flags.h>
 #include <messaging/ReliableMessageContext.h>
+#include <protocols/Protocols.h>
 #include <support/BitFlags.h>
 #include <support/DLLUtil.h>
 #include <system/SystemTimer.h>
@@ -107,7 +108,7 @@ public:
      *  @retval  #CHIP_NO_ERROR                             if the CHIP layer successfully sent the message down to the
      *                                                       network layer.
      */
-    CHIP_ERROR SendMessage(uint16_t protocolId, uint8_t msgType, System::PacketBufferHandle msgPayload,
+    CHIP_ERROR SendMessage(Protocols::Id protocolId, uint8_t msgType, System::PacketBufferHandle msgPayload,
                            const SendFlags & sendFlags);
 
     /**
@@ -117,7 +118,7 @@ public:
     CHIP_ERROR SendMessage(MessageType msgType, System::PacketBufferHandle && msgPayload, const SendFlags & sendFlags)
     {
         static_assert(std::is_same<std::underlying_type_t<MessageType>, uint8_t>::value, "Enum is wrong size; cast is not safe");
-        return SendMessage(Protocols::MessageTypeTraits<MessageType>::ProtocolId, static_cast<uint8_t>(msgType),
+        return SendMessage(Protocols::MessageTypeTraits<MessageType>::ProtocolId(), static_cast<uint8_t>(msgType),
                            std::move(msgPayload), sendFlags);
     }
 
@@ -227,8 +228,8 @@ private:
      * A subset of SendMessage functionality that does not perform message
      * counter sync for group keys.
      */
-    CHIP_ERROR SendMessageImpl(uint16_t protocolId, uint8_t msgType, System::PacketBufferHandle msgBuf, const SendFlags & sendFlags,
-                               Transport::PeerConnectionState * state = nullptr);
+    CHIP_ERROR SendMessageImpl(Protocols::Id protocolId, uint8_t msgType, System::PacketBufferHandle msgBuf,
+                               const SendFlags & sendFlags, Transport::PeerConnectionState * state = nullptr);
     void CancelResponseTimer();
     static void HandleResponseTimeout(System::Layer * aSystemLayer, void * aAppState, System::Error aError);
 
index bec3eb9..f5ea394 100644 (file)
@@ -41,7 +41,6 @@
 #include <support/CHIPFaultInjection.h>
 #include <support/CodeUtils.h>
 #include <support/RandUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 using namespace chip::Encoding;
@@ -80,7 +79,13 @@ CHIP_ERROR ExchangeManager::Init(NodeId localNodeId, TransportMgrBase * transpor
 
     mContextsInUse = 0;
 
-    memset(UMHandlerPool, 0, sizeof(UMHandlerPool));
+    for (auto & handler : UMHandlerPool)
+    {
+        // Mark all handlers as unallocated.  This handles both initial
+        // initialization and the case when the consumer shuts us down and
+        // then re-initializes without removing registered handlers.
+        handler.Delegate = nullptr;
+    }
 
     mTransportMgr->SetRendezvousSession(this);
 
@@ -117,23 +122,23 @@ ExchangeContext * ExchangeManager::NewContext(SecureSessionHandle session, Excha
     return AllocContext(mNextExchangeId++, session, true, delegate);
 }
 
-CHIP_ERROR ExchangeManager::RegisterUnsolicitedMessageHandlerForProtocol(uint32_t protocolId, ExchangeDelegate * delegate)
+CHIP_ERROR ExchangeManager::RegisterUnsolicitedMessageHandlerForProtocol(Protocols::Id protocolId, ExchangeDelegate * delegate)
 {
     return RegisterUMH(protocolId, kAnyMessageType, delegate);
 }
 
-CHIP_ERROR ExchangeManager::RegisterUnsolicitedMessageHandlerForType(uint32_t protocolId, uint8_t msgType,
+CHIP_ERROR ExchangeManager::RegisterUnsolicitedMessageHandlerForType(Protocols::Id protocolId, uint8_t msgType,
                                                                      ExchangeDelegate * delegate)
 {
     return RegisterUMH(protocolId, static_cast<int16_t>(msgType), delegate);
 }
 
-CHIP_ERROR ExchangeManager::UnregisterUnsolicitedMessageHandlerForProtocol(uint32_t protocolId)
+CHIP_ERROR ExchangeManager::UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::Id protocolId)
 {
     return UnregisterUMH(protocolId, kAnyMessageType);
 }
 
-CHIP_ERROR ExchangeManager::UnregisterUnsolicitedMessageHandlerForType(uint32_t protocolId, uint8_t msgType)
+CHIP_ERROR ExchangeManager::UnregisterUnsolicitedMessageHandlerForType(Protocols::Id protocolId, uint8_t msgType)
 {
     return UnregisterUMH(protocolId, static_cast<int16_t>(msgType));
 }
@@ -160,7 +165,7 @@ ExchangeContext * ExchangeManager::AllocContext(uint16_t ExchangeId, SecureSessi
     return nullptr;
 }
 
-CHIP_ERROR ExchangeManager::RegisterUMH(uint32_t protocolId, int16_t msgType, ExchangeDelegate * delegate)
+CHIP_ERROR ExchangeManager::RegisterUMH(Protocols::Id protocolId, int16_t msgType, ExchangeDelegate * delegate)
 {
     UnsolicitedMessageHandler * umh      = UMHandlerPool;
     UnsolicitedMessageHandler * selected = nullptr;
@@ -191,7 +196,7 @@ CHIP_ERROR ExchangeManager::RegisterUMH(uint32_t protocolId, int16_t msgType, Ex
     return CHIP_NO_ERROR;
 }
 
-CHIP_ERROR ExchangeManager::UnregisterUMH(uint32_t protocolId, int16_t msgType)
+CHIP_ERROR ExchangeManager::UnregisterUMH(Protocols::Id protocolId, int16_t msgType)
 {
     UnsolicitedMessageHandler * umh = UMHandlerPool;
 
@@ -294,7 +299,7 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const
 
         for (int i = 0; i < CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS; i++, umh++)
         {
-            if (umh->Delegate != nullptr && umh->ProtocolId == payloadHeader.GetProtocolID())
+            if (umh->Delegate != nullptr && payloadHeader.HasProtocol(umh->ProtocolId))
             {
                 if (umh->MessageType == payloadHeader.GetMessageType())
                 {
index 45c7194..a69a55a 100644 (file)
@@ -31,6 +31,7 @@
 #include <messaging/ExchangeContext.h>
 #include <messaging/MessageCounterSync.h>
 #include <messaging/ReliableMessageMgr.h>
+#include <protocols/Protocols.h>
 #include <support/DLLUtil.h>
 #include <support/Pool.h>
 #include <transport/SecureSessionMgr.h>
@@ -112,7 +113,7 @@ public:
      *                                                             is full and a new one cannot be allocated.
      *  @retval #CHIP_NO_ERROR On success.
      */
-    CHIP_ERROR RegisterUnsolicitedMessageHandlerForProtocol(uint32_t protocolId, ExchangeDelegate * delegate);
+    CHIP_ERROR RegisterUnsolicitedMessageHandlerForProtocol(Protocols::Id protocolId, ExchangeDelegate * delegate);
 
     /**
      *  Register an unsolicited message handler for a given protocol identifier and message type.
@@ -127,7 +128,7 @@ public:
      *                                                             is full and a new one cannot be allocated.
      *  @retval #CHIP_NO_ERROR On success.
      */
-    CHIP_ERROR RegisterUnsolicitedMessageHandlerForType(uint32_t protocolId, uint8_t msgType, ExchangeDelegate * delegate);
+    CHIP_ERROR RegisterUnsolicitedMessageHandlerForType(Protocols::Id protocolId, uint8_t msgType, ExchangeDelegate * delegate);
 
     /**
      * A strongly-message-typed version of RegisterUnsolicitedMessageHandlerForType.
@@ -136,7 +137,7 @@ public:
     CHIP_ERROR RegisterUnsolicitedMessageHandlerForType(MessageType msgType, ExchangeDelegate * delegate)
     {
         static_assert(std::is_same<std::underlying_type_t<MessageType>, uint8_t>::value, "Enum is wrong size; cast is not safe");
-        return RegisterUnsolicitedMessageHandlerForType(Protocols::MessageTypeTraits<MessageType>::ProtocolId,
+        return RegisterUnsolicitedMessageHandlerForType(Protocols::MessageTypeTraits<MessageType>::ProtocolId(),
                                                         static_cast<uint8_t>(msgType), delegate);
     }
 
@@ -149,7 +150,7 @@ public:
      *                                                       is not found.
      *  @retval #CHIP_NO_ERROR On success.
      */
-    CHIP_ERROR UnregisterUnsolicitedMessageHandlerForProtocol(uint32_t protocolId);
+    CHIP_ERROR UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::Id protocolId);
 
     /**
      *  Unregister an unsolicited message handler for a given protocol identifier and message type.
@@ -162,7 +163,7 @@ public:
      *                                                       is not found.
      *  @retval #CHIP_NO_ERROR On success.
      */
-    CHIP_ERROR UnregisterUnsolicitedMessageHandlerForType(uint32_t protocolId, uint8_t msgType);
+    CHIP_ERROR UnregisterUnsolicitedMessageHandlerForType(Protocols::Id protocolId, uint8_t msgType);
 
     /**
      * A strongly-message-typed version of UnregisterUnsolicitedMessageHandlerForType.
@@ -171,7 +172,7 @@ public:
     CHIP_ERROR UnregisterUnsolicitedMessageHandlerForType(MessageType msgType)
     {
         static_assert(std::is_same<std::underlying_type_t<MessageType>, uint8_t>::value, "Enum is wrong size; cast is not safe");
-        return UnregisterUnsolicitedMessageHandlerForType(Protocols::MessageTypeTraits<MessageType>::ProtocolId,
+        return UnregisterUnsolicitedMessageHandlerForType(Protocols::MessageTypeTraits<MessageType>::ProtocolId(),
                                                           static_cast<uint8_t>(msgType));
     }
 
@@ -230,8 +231,9 @@ private:
 
     struct UnsolicitedMessageHandler
     {
+        UnsolicitedMessageHandler() : ProtocolId(Protocols::NotSpecified) {}
         ExchangeDelegate * Delegate;
-        uint32_t ProtocolId;
+        Protocols::Id ProtocolId;
         int16_t MessageType;
     };
 
@@ -255,8 +257,8 @@ private:
 
     ExchangeContext * AllocContext(uint16_t ExchangeId, SecureSessionHandle session, bool Initiator, ExchangeDelegate * delegate);
 
-    CHIP_ERROR RegisterUMH(uint32_t protocolId, int16_t msgType, ExchangeDelegate * delegate);
-    CHIP_ERROR UnregisterUMH(uint32_t protocolId, int16_t msgType);
+    CHIP_ERROR RegisterUMH(Protocols::Id protocolId, int16_t msgType, ExchangeDelegate * delegate);
+    CHIP_ERROR UnregisterUMH(Protocols::Id protocolId, int16_t msgType);
 
     static bool IsMsgCounterSyncMessage(const PayloadHeader & payloadHeader);
 
index d5c9aba..341b23b 100644 (file)
@@ -31,7 +31,6 @@
 #include <protocols/Protocols.h>
 #include <support/BufferWriter.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 namespace chip {
@@ -45,7 +44,7 @@ CHIP_ERROR MessageCounterSyncMgr::Init(Messaging::ExchangeManager * exchangeMgr)
     mExchangeMgr = exchangeMgr;
 
     // Register to receive unsolicited Secure Channel Request messages from the exchange manager.
-    err = mExchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(Protocols::kProtocol_SecureChannel, this);
+    err = mExchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(Protocols::SecureChannel::Id, this);
 
     ReturnErrorOnFailure(err);
 
@@ -56,7 +55,7 @@ void MessageCounterSyncMgr::Shutdown()
 {
     if (mExchangeMgr != nullptr)
     {
-        mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::kProtocol_SecureChannel);
+        mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::SecureChannel::Id);
         mExchangeMgr = nullptr;
     }
 }
@@ -93,7 +92,7 @@ void MessageCounterSyncMgr::OnResponseTimeout(Messaging::ExchangeContext * excha
         exchangeContext->Close();
 }
 
-CHIP_ERROR MessageCounterSyncMgr::AddToRetransmissionTable(uint16_t protocolId, uint8_t msgType, const SendFlags & sendFlags,
+CHIP_ERROR MessageCounterSyncMgr::AddToRetransmissionTable(Protocols::Id protocolId, uint8_t msgType, const SendFlags & sendFlags,
                                                            System::PacketBufferHandle msgBuf,
                                                            Messaging::ExchangeContext * exchangeContext)
 {
@@ -269,7 +268,7 @@ CHIP_ERROR MessageCounterSyncMgr::SendMsgCounterSyncReq(SecureSessionHandle sess
     exchangeContext->SetResponseTimeout(kMsgCounterSyncTimeout);
 
     // Send the message counter synchronization request in a Secure Channel Protocol::MsgCounterSyncReq message.
-    err = exchangeContext->SendMessageImpl(Protocols::kProtocol_SecureChannel,
+    err = exchangeContext->SendMessageImpl(Protocols::SecureChannel::Id,
                                            static_cast<uint8_t>(Protocols::SecureChannel::MsgType::MsgCounterSyncReq),
                                            std::move(msgBuf), sendFlags);
     SuccessOrExit(err);
@@ -318,7 +317,7 @@ CHIP_ERROR MessageCounterSyncMgr::SendMsgCounterSyncResp(Messaging::ExchangeCont
     msgBuf->SetDataLength(kMsgCounterSyncRespMsgSize);
 
     // Send message counter synchronization response message.
-    err = exchangeContext->SendMessageImpl(Protocols::kProtocol_SecureChannel,
+    err = exchangeContext->SendMessageImpl(Protocols::SecureChannel::Id,
                                            static_cast<uint8_t>(Protocols::SecureChannel::MsgType::MsgCounterSyncRsp),
                                            std::move(msgBuf), Messaging::SendFlags(Messaging::SendMessageFlags::kNoAutoRequestAck));
 
index 11117d7..4e2f442 100644 (file)
@@ -22,6 +22,7 @@
 
 #pragma once
 
+#include <protocols/Protocols.h>
 #include <system/SystemPacketBuffer.h>
 
 namespace chip {
@@ -72,7 +73,7 @@ public:
      *  @retval  #CHIP_ERROR_NO_MEMORY If there is no empty slot left in the table for addition.
      *  @retval  #CHIP_NO_ERROR On success.
      */
-    CHIP_ERROR AddToRetransmissionTable(uint16_t protocolId, uint8_t msgType, const SendFlags & sendFlags,
+    CHIP_ERROR AddToRetransmissionTable(Protocols::Id protocolId, uint8_t msgType, const SendFlags & sendFlags,
                                         System::PacketBufferHandle msgBuf, Messaging::ExchangeContext * exchangeContext);
 
     /**
@@ -103,11 +104,12 @@ private:
      */
     struct RetransTableEntry
     {
+        RetransTableEntry() : protocolId(Protocols::NotSpecified) {}
         ExchangeContext * exchangeContext; /**< The ExchangeContext for the stored CHIP message.
                                                 Non-null if and only if this entry is in use. */
         System::PacketBufferHandle msgBuf; /**< A handle to the PacketBuffer object holding the CHIP message. */
         SendFlags sendFlags;               /**< Flags set by the application for the CHIP message being sent. */
-        uint16_t protocolId;               /**< The protocol identifier of the CHIP message to be sent. */
+        Protocols::Id protocolId;          /**< The protocol identifier of the CHIP message to be sent. */
         uint8_t msgType;                   /**< The message type of the CHIP message to be sent. */
     };
 
index 88de214..1564ee9 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 
 namespace chip {
 namespace Test {
index ef5c5a5..3b456c7 100644 (file)
@@ -98,7 +98,8 @@ void CheckExchangeChannels(nlTestSuite * inSuite, void * inContext)
 
     // create unsolicited exchange
     MockAppDelegate mockUnsolicitedAppDelegate;
-    CHIP_ERROR err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(0x0001, 0x0001, &mockUnsolicitedAppDelegate);
+    CHIP_ERROR err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::Id(VendorId::Common, 0x0001),
+                                                                                       0x0001, &mockUnsolicitedAppDelegate);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
     // create the channel
index 5cfaa78..9e181e8 100644 (file)
@@ -111,22 +111,24 @@ void CheckUmhRegistrationTest(nlTestSuite * inSuite, void * inContext)
     CHIP_ERROR err;
     MockAppDelegate mockAppDelegate;
 
-    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForProtocol(0x0001, &mockAppDelegate);
+    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForProtocol(Protocols::Id(VendorId::Common, 0x0001),
+                                                                                &mockAppDelegate);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
-    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(0x0002, 0x0001, &mockAppDelegate);
+    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::Id(VendorId::Common, 0x0002), 0x0001,
+                                                                            &mockAppDelegate);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
-    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForProtocol(0x0001);
+    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::Id(VendorId::Common, 0x0001));
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
-    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForProtocol(0x0002);
+    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::Id(VendorId::Common, 0x0002));
     NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR);
 
-    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(0x0002, 0x0001);
+    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Protocols::Id(VendorId::Common, 0x0002), 0x0001);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
-    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(0x0002, 0x0002);
+    err = ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Protocols::Id(VendorId::Common, 0x0002), 0x0002);
     NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR);
 }
 
@@ -142,7 +144,8 @@ void CheckExchangeMessages(nlTestSuite * inSuite, void * inContext)
 
     // create unsolicited exchange
     MockAppDelegate mockUnsolicitedAppDelegate;
-    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(0x0001, 0x0001, &mockUnsolicitedAppDelegate);
+    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::Id(VendorId::Common, 0x0001), 0x0001,
+                                                                            &mockUnsolicitedAppDelegate);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
     // send a malicious packet
@@ -152,7 +155,8 @@ void CheckExchangeMessages(nlTestSuite * inSuite, void * inContext)
     NL_TEST_ASSERT(inSuite, !mockUnsolicitedAppDelegate.IsOnMessageReceivedCalled);
 
     // send a good packet
-    ec1->SendMessage(0x0001, 0x0001, System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize),
+    ec1->SendMessage(Protocols::Id(VendorId::Common, 0x0001), 0x0001,
+                     System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize),
                      SendFlags(Messaging::SendMessageFlags::kNone));
     NL_TEST_ASSERT(inSuite, mockUnsolicitedAppDelegate.IsOnMessageReceivedCalled);
 }
index 55b84af..614a1e5 100644 (file)
@@ -29,7 +29,6 @@
 #include <protocols/Protocols.h>
 #include <protocols/echo/Echo.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <transport/SecureSessionMgr.h>
 #include <transport/TransportMgr.h>
 
@@ -182,8 +181,7 @@ void CheckReceiveMsgCounterSyncReq(nlTestSuite * inSuite, void * inContext)
     NL_TEST_ASSERT(inSuite, sm != nullptr);
 
     // Register to receive unsolicited Secure Channel Request messages from the exchange manager.
-    err =
-        ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForProtocol(Protocols::kProtocol_SecureChannel, &mockAppDelegate);
+    err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForProtocol(Protocols::SecureChannel::Id, &mockAppDelegate);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 
     Optional<Transport::PeerAddress> peer(Transport::PeerAddress::UDP(addr, CHIP_PORT));
@@ -224,7 +222,7 @@ void CheckAddRetransTable(nlTestSuite * inSuite, void * inContext)
     NL_TEST_ASSERT(inSuite, !buffer.IsNull());
 
     CHIP_ERROR err =
-        sm->AddToRetransmissionTable(Protocols::kProtocol_Echo, static_cast<uint8_t>(Protocols::Echo::MsgType::EchoRequest),
+        sm->AddToRetransmissionTable(Protocols::Echo::Id, static_cast<uint8_t>(Protocols::Echo::MsgType::EchoRequest),
                                      Messaging::SendFlags(Messaging::SendMessageFlags::kNone), std::move(buffer), exchange);
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
 }
index 70cd00e..213f92b 100644 (file)
@@ -30,7 +30,6 @@
 #include <protocols/Protocols.h>
 #include <protocols/echo/Echo.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <transport/SecureSessionMgr.h>
 #include <transport/TransportMgr.h>
 
index 784e7fd..9e24c2e 100644 (file)
@@ -309,6 +309,10 @@ if (chip_device_platform != "none" && chip_device_platform != "external") {
         "Darwin/ConnectivityManagerImpl.h",
         "Darwin/InetPlatformConfig.h",
         "Darwin/Logging.cpp",
+        "Darwin/MdnsError.cpp",
+        "Darwin/MdnsError.h",
+        "Darwin/MdnsImpl.cpp",
+        "Darwin/MdnsImpl.h",
         "Darwin/PlatformManagerImpl.cpp",
         "Darwin/PlatformManagerImpl.h",
         "Darwin/PosixConfig.cpp",
diff --git a/src/platform/Darwin/MdnsError.cpp b/src/platform/Darwin/MdnsError.cpp
new file mode 100644 (file)
index 0000000..b5939be
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "MdnsImpl.h"
+
+namespace chip {
+namespace Mdns {
+namespace Error {
+
+const char * ToString(DNSServiceErrorType errorCode)
+{
+    switch (errorCode)
+    {
+    case kDNSServiceErr_NoError:
+        return "kDNSServiceErr_NoError";
+    case kDNSServiceErr_Unknown:
+        return "kDNSServiceErr_Unknown";
+    case kDNSServiceErr_NoSuchName:
+        return "kDNSServiceErr_NoSuchName";
+    case kDNSServiceErr_NoMemory:
+        return "kDNSServiceErr_NoMemory";
+    case kDNSServiceErr_BadParam:
+        return "kDNSServiceErr_BadParam";
+    case kDNSServiceErr_BadReference:
+        return "kDNSServiceErr_BadReference";
+    case kDNSServiceErr_BadState:
+        return "kDNSServiceErr_BadState";
+    case kDNSServiceErr_BadFlags:
+        return "kDNSServiceErr_BadFlags";
+    case kDNSServiceErr_Unsupported:
+        return "kDNSServiceErr_Unsupported";
+    case kDNSServiceErr_NotInitialized:
+        return "kDNSServiceErr_NotInitialized";
+    case kDNSServiceErr_AlreadyRegistered:
+        return "kDNSServiceErr_AlreadyRegistered";
+    case kDNSServiceErr_NameConflict:
+        return "kDNSServiceErr_NameConflict";
+    case kDNSServiceErr_Invalid:
+        return "kDNSServiceErr_Invalid";
+    case kDNSServiceErr_Firewall:
+        return "kDNSServiceErr_Firewall";
+    case kDNSServiceErr_Incompatible:
+        return "kDNSServiceErr_Incompatible";
+    case kDNSServiceErr_BadInterfaceIndex:
+        return "kDNSServiceErr_BadInterfaceIndex";
+    case kDNSServiceErr_Refused:
+        return "kDNSServiceErr_Refused";
+    case kDNSServiceErr_NoSuchRecord:
+        return "kDNSServiceErr_NoSuchRecord";
+    case kDNSServiceErr_NoAuth:
+        return "kDNSServiceErr_NoAuth";
+    case kDNSServiceErr_NoSuchKey:
+        return "kDNSServiceErr_NoSuchKey";
+    case kDNSServiceErr_NATTraversal:
+        return "kDNSServiceErr_NATTraversal";
+    case kDNSServiceErr_DoubleNAT:
+        return "kDNSServiceErr_DoubleNAT";
+    case kDNSServiceErr_BadTime:
+        return "kDNSServiceErr_BadTime";
+    case kDNSServiceErr_BadSig:
+        return "kDNSServiceErr_BadSig";
+    case kDNSServiceErr_BadKey:
+        return "kDNSServiceErr_BadKey";
+    case kDNSServiceErr_Transient:
+        return "kDNSServiceErr_Transient";
+    case kDNSServiceErr_ServiceNotRunning:
+        return "kDNSServiceErr_ServiceNotRunning";
+    case kDNSServiceErr_NATPortMappingUnsupported:
+        return "kDNSServiceErr_NATPortMappingUnsupported";
+    case kDNSServiceErr_NATPortMappingDisabled:
+        return "kDNSServiceErr_NATPortMappingDisabled";
+    case kDNSServiceErr_NoRouter:
+        return "kDNSServiceErr_NoRouter";
+    case kDNSServiceErr_PollingMode:
+        return "kDNSServiceErr_PollingMode";
+    case kDNSServiceErr_Timeout:
+        return "kDNSServiceErr_Timeout";
+    default:
+        return "Unknown DNSService error code";
+    }
+}
+
+} // namespace Error
+} // namespace Mdns
+} // namespace chip
diff --git a/src/platform/Darwin/MdnsError.h b/src/platform/Darwin/MdnsError.h
new file mode 100644 (file)
index 0000000..3a2fc96
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "MdnsImpl.h"
+
+namespace chip {
+namespace Mdns {
+namespace Error {
+
+const char * ToString(DNSServiceErrorType errorCode);
+
+} // namespace Error
+} // namespace Mdns
+} // namespace chip
diff --git a/src/platform/Darwin/MdnsImpl.cpp b/src/platform/Darwin/MdnsImpl.cpp
new file mode 100644 (file)
index 0000000..ec52c3a
--- /dev/null
@@ -0,0 +1,514 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+#include "MdnsImpl.h"
+
+#include "MdnsError.h"
+
+#include <cstdio>
+#include <sstream>
+#include <string.h>
+
+#include <platform/CHIPDeviceLayer.h>
+#include <support/CHIPMem.h>
+#include <support/CodeUtils.h>
+#include <support/SafeInt.h>
+#include <support/logging/CHIPLogging.h>
+
+using namespace chip::Mdns;
+
+namespace {
+
+constexpr const char * kLocalDomain = "local.";
+constexpr const char * kProtocolTcp = "._tcp";
+constexpr const char * kProtocolUdp = "._udp";
+constexpr uint8_t kMdnsKeyMaxSize   = 32;
+
+bool IsSupportedProtocol(MdnsServiceProtocol protocol)
+{
+    return (protocol == MdnsServiceProtocol::kMdnsProtocolUdp) || (protocol == MdnsServiceProtocol::kMdnsProtocolTcp);
+}
+
+uint32_t GetInterfaceId(chip::Inet::InterfaceId interfaceId)
+{
+    return INET_NULL_INTERFACEID ? 0 : interfaceId;
+}
+
+std::string GetFullType(const char * type, MdnsServiceProtocol protocol)
+{
+    std::ostringstream typeBuilder;
+    typeBuilder << type;
+    typeBuilder << (protocol == MdnsServiceProtocol::kMdnsProtocolUdp ? kProtocolUdp : kProtocolTcp);
+    return typeBuilder.str();
+}
+
+} // namespace
+
+namespace chip {
+namespace Mdns {
+
+MdnsContexts MdnsContexts::sInstance;
+
+void MdnsContexts::Delete(GenericContext * context)
+{
+    if (context->type == ContextType::GetAddrInfo)
+    {
+        GetAddrInfoContext * addrInfoContext = reinterpret_cast<GetAddrInfoContext *>(context);
+        std::vector<TextEntry>::iterator textEntry;
+        for (textEntry = addrInfoContext->textEntries.begin(); textEntry != addrInfoContext->textEntries.end(); textEntry++)
+        {
+            free(const_cast<char *>(textEntry->mKey));
+            free(const_cast<uint8_t *>(textEntry->mData));
+        }
+    }
+
+    DNSServiceRefDeallocate(context->serviceRef);
+    chip::Platform::Delete(context);
+}
+
+MdnsContexts::~MdnsContexts()
+{
+    std::vector<GenericContext *>::const_iterator iter = mContexts.cbegin();
+    while (iter != mContexts.cend())
+    {
+        Delete(*iter);
+        mContexts.erase(iter);
+    }
+}
+
+CHIP_ERROR MdnsContexts::Add(GenericContext * context, DNSServiceRef sdRef)
+{
+    VerifyOrReturnError(context != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(sdRef != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+
+    context->serviceRef = sdRef;
+    mContexts.push_back(context);
+
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR MdnsContexts::Remove(GenericContext * context)
+{
+    bool found = false;
+
+    std::vector<GenericContext *>::const_iterator iter = mContexts.cbegin();
+    while (iter != mContexts.cend())
+    {
+        if (*iter != context)
+        {
+            iter++;
+            continue;
+        }
+
+        Delete(*iter);
+        mContexts.erase(iter);
+        found = true;
+        break;
+    }
+
+    return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND;
+}
+
+CHIP_ERROR MdnsContexts::Removes(ContextType type)
+{
+    bool found = false;
+
+    std::vector<GenericContext *>::const_iterator iter = mContexts.cbegin();
+    while (iter != mContexts.cend())
+    {
+        if ((*iter)->type != type)
+        {
+            iter++;
+            continue;
+        }
+
+        Delete(*iter);
+        mContexts.erase(iter);
+        found = true;
+    }
+
+    return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND;
+}
+
+CHIP_ERROR MdnsContexts::Get(ContextType type, GenericContext * context)
+{
+    bool found = false;
+    std::vector<GenericContext *>::iterator iter;
+
+    for (iter = mContexts.begin(); iter != mContexts.end(); iter++)
+    {
+        if ((*iter)->type == type)
+        {
+            context = *iter;
+            found   = true;
+            break;
+        }
+    }
+
+    return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND;
+}
+
+void MdnsContexts::PrepareSelect(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet, int & maxFd, timeval & timeout)
+{
+    std::vector<DNSServiceRef> serviceRefs(mContexts.size());
+    std::transform(mContexts.begin(), mContexts.end(), serviceRefs.begin(),
+                   [](GenericContext * context) { return context->serviceRef; });
+
+    std::vector<DNSServiceRef>::iterator iter;
+    for (iter = serviceRefs.begin(); iter != serviceRefs.end(); iter++)
+    {
+        int fd = DNSServiceRefSockFD(*iter);
+        FD_SET(fd, &readFdSet);
+        if (maxFd < fd)
+        {
+            maxFd = fd;
+        }
+    }
+}
+
+void MdnsContexts::HandleSelectResult(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet)
+{
+    std::vector<DNSServiceRef> serviceRefs(mContexts.size());
+    std::transform(mContexts.begin(), mContexts.end(), serviceRefs.begin(),
+                   [](GenericContext * context) { return context->serviceRef; });
+
+    std::vector<DNSServiceRef>::iterator iter;
+    for (iter = serviceRefs.begin(); iter != serviceRefs.end(); iter++)
+    {
+        int fd = DNSServiceRefSockFD(*iter);
+        if (FD_ISSET(fd, &readFdSet))
+        {
+            DNSServiceProcessResult(*iter);
+        }
+    }
+}
+
+CHIP_ERROR PopulateTextRecord(TXTRecordRef * record, char * buffer, uint16_t bufferLen, TextEntry * textEntries,
+                              size_t textEntrySize)
+{
+    VerifyOrReturnError(textEntrySize <= kMdnsTextMaxSize, CHIP_ERROR_INVALID_ARGUMENT);
+
+    DNSServiceErrorType err;
+    TXTRecordCreate(record, bufferLen, buffer);
+
+    for (size_t i = 0; i < textEntrySize; i++)
+    {
+        TextEntry entry = textEntries[i];
+        VerifyOrReturnError(chip::CanCastTo<uint8_t>(entry.mDataSize), CHIP_ERROR_INVALID_ARGUMENT);
+
+        err = TXTRecordSetValue(record, entry.mKey, static_cast<uint8_t>(entry.mDataSize), entry.mData);
+        VerifyOrReturnError(err == kDNSServiceErr_NoError, CHIP_ERROR_INVALID_ARGUMENT);
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+bool CheckForSuccess(GenericContext * context, const char * name, DNSServiceErrorType err, bool useCallback = false)
+{
+    if (context == nullptr)
+    {
+        ChipLogError(DeviceLayer, "%s (%s)", name, "Mdns context is null.");
+        return false;
+    }
+
+    if (kDNSServiceErr_NoError != err)
+    {
+        ChipLogError(DeviceLayer, "%s (%s)", name, Error::ToString(err));
+
+        if (useCallback)
+        {
+            switch (context->type)
+            {
+            case ContextType::Register:
+                // Nothing special to do. Maybe ChipMdnsPublishService should take a callback ?
+                break;
+            case ContextType::Browse: {
+                BrowseContext * browseContext = reinterpret_cast<BrowseContext *>(context);
+                browseContext->callback(browseContext->context, nullptr, 0, CHIP_ERROR_INTERNAL);
+                break;
+            }
+            case ContextType::Resolve: {
+                ResolveContext * resolveContext = reinterpret_cast<ResolveContext *>(context);
+                resolveContext->callback(resolveContext->context, nullptr, CHIP_ERROR_INTERNAL);
+                break;
+            }
+            case ContextType::GetAddrInfo: {
+                GetAddrInfoContext * resolveContext = reinterpret_cast<GetAddrInfoContext *>(context);
+                resolveContext->callback(resolveContext->context, nullptr, CHIP_ERROR_INTERNAL);
+                break;
+            }
+            }
+        }
+
+        if (CHIP_ERROR_KEY_NOT_FOUND == MdnsContexts::GetInstance().Remove(context))
+        {
+            chip::Platform::Delete(context);
+        }
+
+        return false;
+    }
+
+    return true;
+}
+
+static void OnRegister(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType err, const char * name, const char * type,
+                       const char * domain, void * context)
+{
+    RegisterContext * sdCtx = reinterpret_cast<RegisterContext *>(context);
+    VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err));
+
+    ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, flags: %d", __func__, name, type, domain, flags);
+};
+
+CHIP_ERROR Register(uint32_t interfaceId, const char * type, const char * name, uint16_t port, TXTRecordRef * recordRef)
+{
+    DNSServiceErrorType err;
+    DNSServiceRef sdRef;
+    RegisterContext * sdCtx = nullptr;
+
+    uint16_t recordLen          = TXTRecordGetLength(recordRef);
+    const void * recordBytesPtr = TXTRecordGetBytesPtr(recordRef);
+
+    if (CHIP_NO_ERROR == MdnsContexts::GetInstance().Get(ContextType::Register, sdCtx))
+    {
+        err = DNSServiceUpdateRecord(sdCtx->serviceRef, NULL, 0 /* flags */, recordLen, recordBytesPtr, 0 /* ttl */);
+        TXTRecordDeallocate(recordRef);
+        VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL);
+        return CHIP_NO_ERROR;
+    }
+
+    sdCtx = chip::Platform::New<RegisterContext>(nullptr);
+    err   = DNSServiceRegister(&sdRef, 0 /* flags */, interfaceId, name, type, kLocalDomain, NULL, port, recordLen, recordBytesPtr,
+                             OnRegister, sdCtx);
+    TXTRecordDeallocate(recordRef);
+
+    VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL);
+
+    return MdnsContexts::GetInstance().Add(sdCtx, sdRef);
+}
+
+void OnBrowseAdd(BrowseContext * context, const char * name, const char * type, const char * domain, uint32_t interfaceId)
+{
+    ChipLogDetail(DeviceLayer, "Mdns: %s  name: %s, type: %s, domain: %s, interface: %d", __func__, name, type, domain,
+                  interfaceId);
+
+    VerifyOrReturn(strcmp(kLocalDomain, domain) == 0);
+
+    char * tokens  = strdup(type);
+    char * regtype = strtok(tokens, ".");
+    free(tokens);
+
+    MdnsService service = {};
+    service.mInterface  = interfaceId;
+    service.mProtocol   = context->protocol;
+
+    strncpy(service.mName, name, sizeof(service.mName));
+    service.mName[kMdnsNameMaxSize] = 0;
+
+    strncpy(service.mType, regtype, sizeof(service.mType));
+    service.mType[kMdnsTypeMaxSize] = 0;
+
+    context->services.push_back(service);
+}
+
+void OnBrowseRemove(BrowseContext * context, const char * name, const char * type, const char * domain, uint32_t interfaceId)
+{
+    ChipLogDetail(DeviceLayer, "Mdns: %s  name: %s, type: %s, domain: %s, interface: %d", __func__, name, type, domain,
+                  interfaceId);
+
+    VerifyOrReturn(strcmp(kLocalDomain, domain) == 0);
+
+    std::remove_if(context->services.begin(), context->services.end(), [name, type, interfaceId](const MdnsService & service) {
+        return strcmp(name, service.mName) == 0 && type == GetFullType(service.mType, service.mProtocol) &&
+            service.mInterface == interfaceId;
+    });
+}
+
+static void OnBrowse(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err, const char * name,
+                     const char * type, const char * domain, void * context)
+{
+    BrowseContext * sdCtx = reinterpret_cast<BrowseContext *>(context);
+    VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true));
+
+    (flags & kDNSServiceFlagsAdd) ? OnBrowseAdd(sdCtx, name, type, domain, interfaceId)
+                                  : OnBrowseRemove(sdCtx, name, type, domain, interfaceId);
+
+    if (!(flags & kDNSServiceFlagsMoreComing))
+    {
+        sdCtx->callback(sdCtx->context, sdCtx->services.data(), sdCtx->services.size(), CHIP_NO_ERROR);
+        MdnsContexts::GetInstance().Remove(sdCtx);
+    }
+}
+
+CHIP_ERROR Browse(void * context, MdnsBrowseCallback callback, uint32_t interfaceId, const char * type,
+                  MdnsServiceProtocol protocol)
+{
+    DNSServiceErrorType err;
+    DNSServiceRef sdRef;
+    BrowseContext * sdCtx;
+
+    sdCtx = chip::Platform::New<BrowseContext>(context, callback, protocol);
+    err   = DNSServiceBrowse(&sdRef, 0 /* flags */, interfaceId, type, kLocalDomain, OnBrowse, sdCtx);
+    VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL);
+
+    return MdnsContexts::GetInstance().Add(sdCtx, sdRef);
+}
+
+static void OnGetAddrInfo(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err,
+                          const char * hostname, const struct sockaddr * address, uint32_t ttl, void * context)
+{
+    GetAddrInfoContext * sdCtx = reinterpret_cast<GetAddrInfoContext *>(context);
+    VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true));
+
+    ChipLogDetail(DeviceLayer, "Mdns: %s hostname:%s", __func__, hostname);
+
+    MdnsService service    = {};
+    service.mPort          = sdCtx->port;
+    service.mTextEntries   = sdCtx->textEntries.empty() ? nullptr : sdCtx->textEntries.data();
+    service.mTextEntrySize = sdCtx->textEntries.empty() ? 0 : sdCtx->textEntries.size();
+    service.mAddress.SetValue(chip::Inet::IPAddress::FromSockAddr(*address));
+
+    sdCtx->callback(sdCtx->context, &service, CHIP_NO_ERROR);
+    MdnsContexts::GetInstance().Remove(sdCtx);
+}
+
+CHIP_ERROR GetAddrInfo(void * context, MdnsResolveCallback callback, uint32_t interfaceId, const char * hostname, uint16_t port,
+                       uint16_t txtLen, const unsigned char * txtRecord)
+{
+    DNSServiceErrorType err;
+    DNSServiceRef sdRef;
+    GetAddrInfoContext * sdCtx;
+
+    sdCtx = chip::Platform::New<GetAddrInfoContext>(context, callback, port);
+
+    char key[kMdnsKeyMaxSize];
+    char value[kMdnsTextMaxSize];
+    uint8_t valueLen;
+    const void * valuePtr;
+
+    uint16_t recordCount = TXTRecordGetCount(txtLen, txtRecord);
+    for (uint16_t i = 0; i < recordCount; i++)
+    {
+        err = TXTRecordGetItemAtIndex(txtLen, txtRecord, i, kMdnsKeyMaxSize, key, &valueLen, &valuePtr);
+        VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL);
+
+        strncpy(value, reinterpret_cast<const char *>(valuePtr), valueLen);
+        value[valueLen] = 0;
+
+        sdCtx->textEntries.push_back(TextEntry{ strdup(key), reinterpret_cast<const uint8_t *>(strdup(value)), valueLen });
+    }
+
+    err = DNSServiceGetAddrInfo(&sdRef, 0 /* flags */, interfaceId, kDNSServiceProtocol_IPv4, hostname, OnGetAddrInfo, sdCtx);
+    VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL);
+
+    return MdnsContexts::GetInstance().Add(sdCtx, sdRef);
+}
+
+static void OnResolve(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err,
+                      const char * fullname, const char * hostname, uint16_t port, uint16_t txtLen, const unsigned char * txtRecord,
+                      void * context)
+{
+    ResolveContext * sdCtx = reinterpret_cast<ResolveContext *>(context);
+    VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true));
+
+    GetAddrInfo(sdCtx->context, sdCtx->callback, interfaceId, hostname, port, txtLen, txtRecord);
+    MdnsContexts::GetInstance().Remove(sdCtx);
+}
+
+CHIP_ERROR Resolve(void * context, MdnsResolveCallback callback, uint32_t interfaceId, const char * type, const char * name)
+{
+    DNSServiceErrorType err;
+    DNSServiceRef sdRef;
+    ResolveContext * sdCtx;
+
+    sdCtx = chip::Platform::New<ResolveContext>(context, callback);
+    err   = DNSServiceResolve(&sdRef, 0 /* flags */, interfaceId, name, type, kLocalDomain, OnResolve, sdCtx);
+    VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL);
+
+    return MdnsContexts::GetInstance().Add(sdCtx, sdRef);
+}
+
+CHIP_ERROR ChipMdnsInit(MdnsAsyncReturnCallback successCallback, MdnsAsyncReturnCallback errorCallback, void * context)
+{
+    VerifyOrReturnError(successCallback != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(errorCallback != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+
+    successCallback(context, CHIP_NO_ERROR);
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR ChipMdnsSetHostname(const char * hostname)
+{
+    MdnsContexts::GetInstance().SetHostname(hostname);
+    return CHIP_NO_ERROR;
+}
+
+CHIP_ERROR ChipMdnsPublishService(const MdnsService * service)
+{
+    VerifyOrReturnError(service != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(IsSupportedProtocol(service->mProtocol), CHIP_ERROR_INVALID_ARGUMENT);
+
+    std::string regtype  = GetFullType(service->mType, service->mProtocol);
+    uint32_t interfaceId = GetInterfaceId(service->mInterface);
+
+    TXTRecordRef record;
+    char buffer[kMdnsTextMaxSize];
+    ReturnErrorOnFailure(PopulateTextRecord(&record, buffer, sizeof(buffer), service->mTextEntries, service->mTextEntrySize));
+
+    return Register(interfaceId, regtype.c_str(), service->mName, service->mPort, &record);
+}
+
+CHIP_ERROR ChipMdnsStopPublish()
+{
+    return MdnsContexts::GetInstance().Removes(ContextType::Register);
+}
+
+CHIP_ERROR ChipMdnsBrowse(const char * type, MdnsServiceProtocol protocol, chip::Inet::IPAddressType addressType,
+                          chip::Inet::InterfaceId interface, MdnsBrowseCallback callback, void * context)
+{
+    VerifyOrReturnError(type != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(callback != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(IsSupportedProtocol(protocol), CHIP_ERROR_INVALID_ARGUMENT);
+
+    std::string regtype  = GetFullType(type, protocol);
+    uint32_t interfaceId = GetInterfaceId(interface);
+
+    return Browse(context, callback, interfaceId, regtype.c_str(), protocol);
+}
+
+CHIP_ERROR ChipMdnsResolve(MdnsService * service, chip::Inet::InterfaceId interface, MdnsResolveCallback callback, void * context)
+{
+    VerifyOrReturnError(service != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
+    VerifyOrReturnError(IsSupportedProtocol(service->mProtocol), CHIP_ERROR_INVALID_ARGUMENT);
+
+    std::string regtype  = GetFullType(service->mType, service->mProtocol);
+    uint32_t interfaceId = GetInterfaceId(service->mInterface);
+
+    return Resolve(context, callback, interfaceId, regtype.c_str(), service->mName);
+}
+
+void UpdateMdnsDataset(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet, int & maxFd, timeval & timeout)
+{
+    MdnsContexts::GetInstance().PrepareSelect(readFdSet, writeFdSet, errorFdSet, maxFd, timeout);
+}
+
+void ProcessMdns(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet)
+{
+    MdnsContexts::GetInstance().HandleSelectResult(readFdSet, writeFdSet, errorFdSet);
+}
+
+} // namespace Mdns
+} // namespace chip
diff --git a/src/platform/Darwin/MdnsImpl.h b/src/platform/Darwin/MdnsImpl.h
new file mode 100644 (file)
index 0000000..287e896
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#pragma once
+
+#include <dns_sd.h>
+#include <lib/mdns/platform/Mdns.h>
+#include <string>
+#include <vector>
+
+namespace chip {
+namespace Mdns {
+
+enum class ContextType
+{
+    Register,
+    Browse,
+    Resolve,
+    GetAddrInfo,
+};
+
+struct GenericContext
+{
+    ContextType type;
+    void * context;
+    DNSServiceRef serviceRef;
+};
+
+struct RegisterContext : public GenericContext
+{
+    RegisterContext(void * cbContext)
+    {
+        type    = ContextType::Register;
+        context = cbContext;
+    }
+};
+
+struct BrowseContext : public GenericContext
+{
+    MdnsBrowseCallback callback;
+    std::vector<MdnsService> services;
+    MdnsServiceProtocol protocol;
+
+    BrowseContext(void * cbContext, MdnsBrowseCallback cb, MdnsServiceProtocol cbContextProtocol)
+    {
+        type     = ContextType::Browse;
+        context  = cbContext;
+        callback = cb;
+        protocol = cbContextProtocol;
+    }
+};
+
+struct ResolveContext : public GenericContext
+{
+    MdnsResolveCallback callback;
+
+    ResolveContext(void * cbContext, MdnsResolveCallback cb)
+    {
+        type     = ContextType::Resolve;
+        context  = cbContext;
+        callback = cb;
+    }
+};
+
+struct GetAddrInfoContext : public GenericContext
+{
+    MdnsResolveCallback callback;
+    std::vector<TextEntry> textEntries;
+    uint16_t port;
+
+    GetAddrInfoContext(void * cbContext, MdnsResolveCallback cb, uint16_t cbContextPort)
+    {
+        type     = ContextType::GetAddrInfo;
+        context  = cbContext;
+        callback = cb;
+        port     = cbContextPort;
+    }
+};
+
+class MdnsContexts
+{
+public:
+    MdnsContexts(const MdnsContexts &) = delete;
+    MdnsContexts & operator=(const MdnsContexts &) = delete;
+    ~MdnsContexts();
+    static MdnsContexts & GetInstance() { return sInstance; }
+
+    void PrepareSelect(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet, int & maxFd, timeval & timeout);
+    void HandleSelectResult(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet);
+
+    CHIP_ERROR Add(GenericContext * context, DNSServiceRef sdRef);
+    CHIP_ERROR Remove(GenericContext * context);
+    CHIP_ERROR Removes(ContextType type);
+    CHIP_ERROR Get(ContextType type, GenericContext * context);
+
+    void SetHostname(const char * name) { mHostname = name; }
+    const char * GetHostname() { return mHostname.c_str(); }
+
+private:
+    MdnsContexts(){};
+    static MdnsContexts sInstance;
+    std::string mHostname;
+
+    void Delete(GenericContext * context);
+    std::vector<GenericContext *> mContexts;
+};
+
+} // namespace Mdns
+} // namespace chip
index 62fc257..b34a4ad 100644 (file)
 
 #include <platform/internal/BLEManager.h>
 
+#include "FreeRTOS.h"
 #include "sl_bt_api.h"
 #include "sl_bt_stack_config.h"
 #include "sl_bt_stack_init.h"
+#include "timers.h"
 #include <ble/CHIPBleServiceData.h>
 #include <platform/EFR32/freertos_bluetooth.h>
 #include <support/CodeUtils.h>
@@ -74,6 +76,8 @@ namespace {
 #define BLE_CONFIG_RF_PATH_GAIN_TX (0)
 #define BLE_CONFIG_RF_PATH_GAIN_RX (0)
 
+TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer.
+
 /* Bluetooth stack configuration parameters (see "UG136: Silicon Labs Bluetooth C Application Developer's Guide" for
  * details on each parameter) */
 static sl_bt_configuration_t config;
@@ -171,6 +175,14 @@ CHIP_ERROR BLEManagerImpl::_Init()
                 CHIP_DEVICE_CONFIG_BLE_APP_TASK_PRIORITY,                         /* Priority at which the task is created. */
                 NULL);                                                            /* Variable to hold the task's data structure. */
 
+    // Create FreeRTOS sw timer for BLE timeouts and interval change.
+    sbleAdvTimeoutTimer = xTimerCreate("BleAdvTimer",       // Just a text name, not used by the RTOS kernel
+                                       1,                   // == default timer period (mS)
+                                       false,               // no timer reload (==one-shot)
+                                       (void *) this,       // init timer id = ble obj context
+                                       BleAdvTimeoutHandler // timer callback handler
+    );
+
     mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
     mFlags.Set(Flags::kFastAdvertisingEnabled, true);
     PlatformMgr().ScheduleWork(DriveBLEState, 0);
@@ -679,6 +691,8 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
 {
     CHIP_ERROR err;
     sl_status_t ret;
+    const uint8_t kResolvableRandomAddrType = 2; // Private resolvable random address type
+    bd_addr unusedBdAddr;                        // We can ignore this field when setting random address.
     uint32_t interval_min;
     uint32_t interval_max;
     uint16_t numConnectionss = NumConnections();
@@ -688,6 +702,9 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     err = ConfigureAdvertisingData();
     SuccessOrExit(err);
 
+    sl_bt_advertiser_set_random_address(advertising_set_handle, kResolvableRandomAddrType, unusedBdAddr, &unusedBdAddr);
+    (void) unusedBdAddr;
+
     mFlags.Clear(Flags::kRestartAdvertising);
 
     if ((numConnectionss == 0 && !ConfigurationMgr().IsPairedToAccount()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
@@ -709,6 +726,9 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
 
     if (SL_STATUS_OK == ret)
     {
+        uint32_t BleAdvTimeoutMs = (mFlags.Has(Flags::kFastAdvertisingEnabled) ? CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT
+                                                                               : CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT);
+        StartBleAdvTimeoutTimer(BleAdvTimeoutMs);
         mFlags.Set(Flags::kAdvertising);
     }
 
@@ -733,6 +753,8 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
         advertising_set_handle = 0xff;
         err                    = MapBLEError(ret);
         SuccessOrExit(err);
+
+        CancelBleAdvTimeoutTimer();
     }
 
 exit:
@@ -818,6 +840,7 @@ void BLEManagerImpl::HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt)
         // Arrange to re-enable connectable advertising in case it was disabled due to the
         // maximum connection limit being reached.
         mFlags.Set(Flags::kRestartAdvertising);
+        mFlags.Set(Flags::kFastAdvertisingEnabled);
         PlatformMgr().ScheduleWork(DriveBLEState, 0);
     }
 }
@@ -1036,6 +1059,71 @@ uint8_t BLEManagerImpl::GetTimerHandle(uint8_t connectionHandle, bool allocate)
     return freeIndex;
 }
 
+void BLEManagerImpl::BleAdvTimeoutHandler(TimerHandle_t xTimer)
+{
+    CHIP_ERROR err;
+    sl_status_t ret;
+
+    if (sInstance.mFlags.Has(Flags::kFastAdvertisingEnabled))
+    {
+        ChipLogDetail(DeviceLayer, "bleAdv Timeout : Start slow advertissment");
+
+        sInstance.mFlags.Clear(Flags::kFastAdvertisingEnabled);
+
+        // stop advertiser, change interval and restart it;
+        sl_bt_advertiser_stop(sInstance.advertising_set_handle);
+        ret = sl_bt_advertiser_set_timing(sInstance.advertising_set_handle, CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL,
+                                          CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL, 0, 0);
+
+        err = sInstance.MapBLEError(ret);
+        SuccessOrExit(err);
+
+        uint8_t connectableAdv = (sInstance.NumConnections() < kMaxConnections) ? sl_bt_advertiser_connectable_scannable
+                                                                                : sl_bt_advertiser_scannable_non_connectable;
+        ret = sl_bt_advertiser_start(sInstance.advertising_set_handle, sl_bt_advertiser_user_data, connectableAdv);
+        err = sInstance.MapBLEError(ret);
+        SuccessOrExit(err);
+
+        sInstance.StartBleAdvTimeoutTimer(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT); // Slow advertise for 15 Minutesß
+    }
+    else if (sInstance._IsAdvertisingEnabled())
+    {
+        // advertissement expired. we stop advertissing
+        ChipLogDetail(DeviceLayer, "bleAdv Timeout : Stop advertissement");
+        sInstance.StopAdvertising();
+    }
+
+exit:
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(DeviceLayer, "Changing Bl advertiser interval failed %s", ErrorStr(err));
+    }
+}
+
+void BLEManagerImpl::CancelBleAdvTimeoutTimer(void)
+{
+    if (xTimerStop(sbleAdvTimeoutTimer, 0) == pdFAIL)
+    {
+        ChipLogError(DeviceLayer, "Failed to stop BledAdv timeout timer");
+    }
+}
+
+void BLEManagerImpl::StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs)
+{
+    if (xTimerIsTimerActive(sbleAdvTimeoutTimer))
+    {
+        CancelBleAdvTimeoutTimer();
+    }
+
+    // timer is not active, change its period to required value (== restart).
+    // FreeRTOS- Block for a maximum of 100 ticks if the change period command
+    // cannot immediately be sent to the timer command queue.
+    if (xTimerChangePeriod(sbleAdvTimeoutTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS)
+    {
+        ChipLogError(DeviceLayer, "Failed to start BledAdv timeout timer");
+    }
+}
+
 void BLEManagerImpl::DriveBLEState(intptr_t arg)
 {
     sInstance.DriveBLEState();
index 18b86bd..b00c99a 100644 (file)
 #pragma once
 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
 
+#include "FreeRTOS.h"
 #include "gatt_db.h"
 #include "sl_bgapi.h"
 #include "sl_bt_api.h"
+#include "timers.h"
 
 namespace chip {
 namespace DeviceLayer {
@@ -141,10 +143,13 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
     void HandleSoftTimerEvent(volatile sl_bt_msg_t * evt);
     bool RemoveConnection(uint8_t connectionHandle);
     void AddConnection(uint8_t connectionHandle, uint8_t bondingHandle);
+    void StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs);
+    void CancelBleAdvTimeoutTimer(void);
     CHIPoBLEConState * GetConnectionState(uint8_t conId, bool allocate = false);
     uint8_t GetTimerHandle(uint8_t connectionHandle, bool allocate = false);
     static void DriveBLEState(intptr_t arg);
     static void bluetoothStackEventHandler(void * p_arg);
+    static void BleAdvTimeoutHandler(TimerHandle_t xTimer);
 };
 
 /**
index 991a439..b90115c 100644 (file)
@@ -58,10 +58,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
     CHIP_ERROR err;
     wifi_init_config_t cfg;
     uint8_t ap_mac[6];
-
-    esp_fill_random(ap_mac, sizeof(ap_mac));
-    /* Bit 0 of the first octet of MAC Address should always be 0 */
-    ap_mac[0] &= (uint8_t) ~0x01;
+    wifi_mode_t mode;
 
     // Make sure the LwIP core lock has been initialized
     err = Internal::InitLwIPCoreLock();
@@ -87,8 +84,15 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
     err = esp_wifi_init(&cfg);
     SuccessOrExit(err);
 
-    err = esp_wifi_set_mac(ESP_IF_WIFI_AP, ap_mac);
-    SuccessOrExit(err);
+    esp_wifi_get_mode(&mode);
+    if ((mode == WIFI_MODE_AP) || (mode == WIFI_MODE_APSTA))
+    {
+        esp_fill_random(ap_mac, sizeof(ap_mac));
+        /* Bit 0 of the first octet of MAC Address should always be 0 */
+        ap_mac[0] &= (uint8_t) ~0x01;
+        err = esp_wifi_set_mac(ESP_IF_WIFI_AP, ap_mac);
+        SuccessOrExit(err);
+    }
 
     // Call _InitChipStack() on the generic implementation base class
     // to finish the initialization process.
index 63ad951..904528b 100644 (file)
@@ -1057,13 +1057,6 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     memset(&adv_params, 0, sizeof(adv_params));
     uint8_t own_addr_type = BLE_OWN_ADDR_RANDOM;
 
-    ret = ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA);
-    if (ret != 0)
-    {
-        ChipLogError(DeviceLayer, "RPA not set: %d", ret);
-        return CHIP_ERROR_INTERNAL;
-    }
-
     adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
 
     // Inform the ThreadStackManager that CHIPoBLE advertising is about to start.
@@ -1080,9 +1073,9 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
     bool connectable     = (numCons < kMaxConnections);
     adv_params.conn_mode = connectable ? BLE_GAP_CONN_MODE_UND : BLE_GAP_CONN_MODE_NON;
 
-    // Advertise in fast mode if not fully provisioned and there are no CHIPoBLE connections, or
-    // if the application has expressly requested fast advertising.
-    if ((numCons == 0 && !ConfigurationMgr().IsPairedToAccount()) || mFlags.Has(Flags::kFastAdvertisingEnabled))
+    // Advertise in fast mode if it is connectable advertisement and
+    // the application has expressly requested fast advertising.
+    if (connectable && mFlags.Has(Flags::kFastAdvertisingEnabled))
     {
         adv_params.itvl_min = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MIN;
         adv_params.itvl_max = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX;
@@ -1097,10 +1090,9 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
                     (((uint32_t) adv_params.itvl_min) * 10) / 16, (connectable) ? "" : "non-", mDeviceName);
 
     {
-        ret = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER, &adv_params, ble_svr_gap_event, NULL);
-        if (ret == BLE_HS_EALREADY)
+        if (ble_gap_adv_active())
         {
-            /* This error code indicates that the advertising is already active. Stop and restart with the new parameters */
+            /* Advertising is already active. Stop and restart with the new parameters */
             ChipLogProgress(DeviceLayer, "Device already advertising, stop active advertisement and restart");
             ret = ble_gap_adv_stop();
             if (ret != 0)
@@ -1108,11 +1100,17 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)
                 ChipLogError(DeviceLayer, "ble_gap_adv_stop() failed: %d, cannot restart", ret);
                 return CHIP_ERROR_INTERNAL;
             }
-            else
+        }
+        else
+        {
+            ret = ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA);
+            if (ret != 0)
             {
-                ret = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER, &adv_params, ble_svr_gap_event, NULL);
+                ChipLogError(DeviceLayer, "RPA not set: %d", ret);
+                return CHIP_ERROR_INTERNAL;
             }
         }
+        ret = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER, &adv_params, ble_svr_gap_event, NULL);
 
         if (ret == 0)
         {
index 0a7a06b..f0f515d 100644 (file)
@@ -29,6 +29,7 @@
 #include <support/CodeUtils.h>
 #include <support/SafeInt.h>
 
+#include <cassert>
 #include <type_traits>
 #include <utility>
 
@@ -46,12 +47,21 @@ namespace Internal {
 namespace {
 
 static constexpr unsigned kNewConnectionScanTimeoutMs = 10000;
+static constexpr unsigned kConnectTimeoutMs           = 5000;
 
 const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F,
                                                  0x9D, 0x11 } };
 const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F,
                                                  0x9D, 0x12 } };
 
+void HandleConnectTimeout(chip::System::Layer *, void * apEndpoint, chip::System::Error)
+{
+    assert(apEndpoint != nullptr);
+
+    CancelConnect(static_cast<BluezEndpoint *>(apEndpoint));
+    BLEManagerImpl::HandleConnectFailed(CHIP_ERROR_TIMEOUT);
+}
+
 } // namespace
 
 BLEManagerImpl BLEManagerImpl::sInstance;
@@ -267,8 +277,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv
     switch (apEvent->Type)
     {
     case DeviceEventType::kPlatformLinuxBLECentralConnected:
-        if (OnConnectionComplete != nullptr)
+        if (mBLEScanConfig.mBleScanState == BleScanState::kConnecting)
+        {
             OnConnectionComplete(mBLEScanConfig.mAppState, apEvent->Platform.BLECentralConnected.mConnection);
+            CleanScanConfig();
+        }
+        break;
+    case DeviceEventType::kPlatformLinuxBLECentralConnectFailed:
+        if (mBLEScanConfig.mBleScanState == BleScanState::kConnecting)
+        {
+            OnConnectionError(mBLEScanConfig.mAppState, apEvent->Platform.BLECentralConnectFailed.mError);
+            CleanScanConfig();
+        }
         break;
     case DeviceEventType::kPlatformLinuxBLEWriteComplete:
         HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX);
@@ -423,6 +443,17 @@ void BLEManagerImpl::HandleNewConnection(BLE_CONNECTION_OBJECT conId)
     }
 }
 
+void BLEManagerImpl::HandleConnectFailed(CHIP_ERROR error)
+{
+    if (sInstance.mIsCentral)
+    {
+        ChipDeviceEvent event;
+        event.Type                                    = DeviceEventType::kPlatformLinuxBLECentralConnectFailed;
+        event.Platform.BLECentralConnectFailed.mError = error;
+        PlatformMgr().PostEvent(&event);
+    }
+}
+
 void BLEManagerImpl::HandleWriteComplete(BLE_CONNECTION_OBJECT conId)
 {
     ChipDeviceEvent event;
@@ -660,13 +691,12 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType)
         return;
     }
 
-    mDeviceScanner = Internal::ChipDeviceScanner::Create(mpEndpoint->mpAdapter, this);
-
-    mBLEScanConfig.bleScanState = BleScanState::kScanForDiscriminator;
+    mDeviceScanner               = Internal::ChipDeviceScanner::Create(mpEndpoint->mpAdapter, this);
+    mBLEScanConfig.mBleScanState = scanType;
 
     if (!mDeviceScanner)
     {
-        mBLEScanConfig.bleScanState = BleScanState::kNotScanning;
+        mBLEScanConfig.mBleScanState = BleScanState::kNotScanning;
         OnConnectionError(mBLEScanConfig.mAppState, CHIP_ERROR_INTERNAL);
         ChipLogError(Ble, "Failed to create a BLE device scanner");
         return;
@@ -675,13 +705,21 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType)
     CHIP_ERROR err = mDeviceScanner->StartScan(kNewConnectionScanTimeoutMs);
     if (err != CHIP_NO_ERROR)
     {
-        mBLEScanConfig.bleScanState = BleScanState::kNotScanning;
+        mBLEScanConfig.mBleScanState = BleScanState::kNotScanning;
         ChipLogError(Ble, "Failed to start a BLE can: %s", chip::ErrorStr(err));
         OnConnectionError(mBLEScanConfig.mAppState, err);
         return;
     }
 }
 
+void BLEManagerImpl::CleanScanConfig()
+{
+    if (mBLEScanConfig.mBleScanState == BleScanState::kConnecting)
+        DeviceLayer::SystemLayer.CancelTimer(HandleConnectTimeout, mpEndpoint);
+
+    mBLEScanConfig.mBleScanState = BleScanState::kNotScanning;
+}
+
 void BLEManagerImpl::InitiateScan(intptr_t arg)
 {
     sInstance.InitiateScan(static_cast<BleScanState>(arg));
@@ -741,7 +779,7 @@ void BLEManagerImpl::OnDeviceScanned(BluezDevice1 * device, const chip::Ble::Chi
 {
     ChipLogProgress(Ble, "New device scanned: %s", bluez_device1_get_address(device));
 
-    if (mBLEScanConfig.bleScanState == BleScanState::kScanForDiscriminator)
+    if (mBLEScanConfig.mBleScanState == BleScanState::kScanForDiscriminator)
     {
         if (info.GetDeviceDiscriminator() != mBLEScanConfig.mDiscriminator)
         {
@@ -749,7 +787,7 @@ void BLEManagerImpl::OnDeviceScanned(BluezDevice1 * device, const chip::Ble::Chi
         }
         ChipLogProgress(Ble, "Device discriminator match. Attempting to connect.");
     }
-    else if (mBLEScanConfig.bleScanState == BleScanState::kScanForAddress)
+    else if (mBLEScanConfig.mBleScanState == BleScanState::kScanForAddress)
     {
         if (strcmp(bluez_device1_get_address(device), mBLEScanConfig.mAddress.c_str()) != 0)
         {
@@ -764,22 +802,24 @@ void BLEManagerImpl::OnDeviceScanned(BluezDevice1 * device, const chip::Ble::Chi
         return;
     }
 
-    mBLEScanConfig.bleScanState = BleScanState::kNotScanning;
+    mBLEScanConfig.mBleScanState = BleScanState::kConnecting;
+    DeviceLayer::SystemLayer.StartTimer(kConnectTimeoutMs, HandleConnectTimeout, mpEndpoint);
     mDeviceScanner->StopScan();
 
-    ConnectDevice(device);
+    ConnectDevice(device, mpEndpoint);
 }
 
 void BLEManagerImpl::OnScanComplete()
 {
-    if (mBLEScanConfig.bleScanState == BleScanState::kNotScanning)
+    if (mBLEScanConfig.mBleScanState != BleScanState::kScanForDiscriminator &&
+        mBLEScanConfig.mBleScanState != BleScanState::kScanForAddress)
     {
-        ChipLogError(Ble, "Scan complete notification without an active scan.");
+        ChipLogProgress(Ble, "Scan complete notification without an active scan.");
         return;
     }
 
     OnConnectionError(mBLEScanConfig.mAppState, CHIP_ERROR_TIMEOUT);
-    mBLEScanConfig.bleScanState = BleScanState::kNotScanning;
+    mBLEScanConfig.mBleScanState = BleScanState::kNotScanning;
 }
 
 } // namespace Internal
index cca8abc..72705ba 100644 (file)
@@ -52,17 +52,18 @@ struct BLEAdvConfig
     const char * mpAdvertisingUUID;
 };
 
-enum class BleScanState
+enum class BleScanState : uint8_t
 {
     kNotScanning,
     kScanForDiscriminator,
     kScanForAddress,
+    kConnecting,
 };
 
 struct BLEScanConfig
 {
-    // If a active scan for connection is being performed
-    BleScanState bleScanState = BleScanState::kNotScanning;
+    // If an active scan for connection is being performed
+    BleScanState mBleScanState = BleScanState::kNotScanning;
 
     // If scanning by discriminator, what are we scanning for
     uint16_t mDiscriminator = 0;
@@ -93,6 +94,7 @@ public:
 
     // Driven by BlueZ IO
     static void HandleNewConnection(BLE_CONNECTION_OBJECT conId);
+    static void HandleConnectFailed(CHIP_ERROR error);
     static void HandleWriteComplete(BLE_CONNECTION_OBJECT conId);
     static void HandleSubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool subscribed);
     static void HandleTXCharChanged(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len);
@@ -100,7 +102,6 @@ public:
     static void CHIPoBluez_ConnectionClosed(BLE_CONNECTION_OBJECT user_data);
     static void HandleTXCharCCCDWrite(BLE_CONNECTION_OBJECT user_data);
     static void HandleTXComplete(BLE_CONNECTION_OBJECT user_data);
-    static bool WoBLEz_TimerCb(BLE_CONNECTION_OBJECT user_data);
 
     static void NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate);
     static void NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate);
@@ -192,6 +193,7 @@ private:
 
     void InitiateScan(BleScanState scanType);
     static void InitiateScan(intptr_t arg);
+    void CleanScanConfig();
 
     CHIPoBLEServiceMode mServiceMode;
     BLEAdvConfig mBLEAdvConfig;
index cccd646..6daae6a 100644 (file)
@@ -45,6 +45,7 @@ enum InternalPlatformSpecificEventTypes
 {
     kPlatformLinuxEvent = kRange_InternalPlatformSpecific,
     kPlatformLinuxBLECentralConnected,
+    kPlatformLinuxBLECentralConnectFailed,
     kPlatformLinuxBLEWriteComplete,
     kPlatformLinuxBLESubscribeOpComplete,
     kPlatformLinuxBLEIndicationReceived,
@@ -71,6 +72,10 @@ struct ChipDevicePlatformEvent
         } BLECentralConnected;
         struct
         {
+            CHIP_ERROR mError;
+        } BLECentralConnectFailed;
+        struct
+        {
             BLE_CONNECTION_OBJECT mConnection;
         } BLEWriteComplete;
         struct
index 6d6f2c4..b45e6d0 100644 (file)
@@ -31,8 +31,6 @@
 
 #include <thread>
 
-#include "MdnsImpl.h"
-
 #include <arpa/inet.h>
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
index b4f755f..e956192 100644 (file)
@@ -51,6 +51,8 @@ using otbr::DBus::NeighborInfo;
         }                                                                                                                          \
     } while (0)
 
+constexpr int kDBusConnectionPollingTimeoutMS = 10;
+
 namespace chip {
 namespace DeviceLayer {
 
@@ -66,8 +68,7 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack()
     DBusConnection * dispatchConnection;
 
     dbus_error_init(&dbusError);
-    mConnection = UniqueDBusConnection(dbus_bus_get(DBUS_BUS_SYSTEM, &dbusError));
-    VerifyOrExit(dbus_bus_register(mConnection.get(), &dbusError), error = ClientError::ERROR_DBUS);
+    mConnection = UniqueDBusConnection(dbus_bus_get_private(DBUS_BUS_SYSTEM, &dbusError));
 
     VerifyOrExit(mConnection != nullptr, error = ClientError::ERROR_DBUS);
     mThreadApi = std::unique_ptr<otbr::DBus::ThreadApiDBus>(new otbr::DBus::ThreadApiDBus(mConnection.get()));
@@ -81,7 +82,10 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack()
     mDBusEventLoop     = std::thread([dispatchConnection]() {
         while (true)
         {
-            dbus_connection_read_write_dispatch(dispatchConnection, -1);
+            // The dbus_connection_read_write will lock the connection until new message comes or timeout.
+            // This will block ot-br-posix APIs. Set timeout to 10ms so it can work.
+            // TODO: we should have a global event loop for dbus to take care of this.
+            dbus_connection_read_write_dispatch(dispatchConnection, kDBusConnectionPollingTimeoutMS);
         }
     });
     mDBusEventLoop.detach();
index 0f2bf9a..d960e1b 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <errno.h>
 #include <pthread.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 namespace chip {
index bb61299..e2a2078 100644 (file)
 #include <protocols/Protocols.h>
 #include <setup_payload/AdditionalDataPayloadGenerator.h>
 #include <support/BitFlags.h>
+#include <support/CHIPMem.h>
 #include <support/CHIPMemString.h>
 
 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
+#include <cassert>
 #include <errno.h>
 #include <gio/gunixfdlist.h>
 #include <limits>
@@ -67,7 +69,6 @@
 
 #include <platform/Linux/BLEManagerImpl.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <system/TLVPacketBufferBackingStore.h>
 
 #include "BluezObjectIterator.h"
@@ -1163,7 +1164,7 @@ void EndpointCleanup(BluezEndpoint * apEndpoint)
             g_free(apEndpoint->mpPeerDevicePath);
             apEndpoint->mpPeerDevicePath = nullptr;
         }
-
+        g_free(apEndpoint->mpConnectCancellable);
         g_free(apEndpoint);
     }
 }
@@ -1554,7 +1555,8 @@ CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & a
     }
     else
     {
-        endpoint->mAdapterId = aBleAdvConfig.mAdapterId;
+        endpoint->mAdapterId           = aBleAdvConfig.mAdapterId;
+        endpoint->mpConnectCancellable = g_cancellable_new();
     }
 
     err = MainLoop::Instance().EnsureStarted();
@@ -1718,13 +1720,26 @@ bool BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn)
 
 // ConnectDevice callbacks
 
+struct ConnectParams
+{
+    ConnectParams(BluezDevice1 * device, BluezEndpoint * endpoint) : mDevice(device), mEndpoint(endpoint) {}
+    BluezDevice1 * mDevice;
+    BluezEndpoint * mEndpoint;
+};
+
 static void ConnectDeviceDone(GObject * aObject, GAsyncResult * aResult, gpointer)
 {
     BluezDevice1 * device = BLUEZ_DEVICE1(aObject);
     GError * error        = nullptr;
     gboolean success      = bluez_device1_call_connect_finish(device, aResult, &error);
 
-    VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: ConnectDevice : %s", error->message));
+    if (!success)
+    {
+        ChipLogError(DeviceLayer, "FAIL: ConnectDevice : %s", error->message);
+        BLEManagerImpl::HandleConnectFailed(CHIP_ERROR_INTERNAL);
+        ExitNow();
+    }
+
     ChipLogDetail(DeviceLayer, "ConnectDevice complete");
 
 exit:
@@ -1732,30 +1747,42 @@ exit:
         g_error_free(error);
 }
 
-static gboolean ConnectDeviceImpl(BluezDevice1 * device)
+static gboolean ConnectDeviceImpl(ConnectParams * apParams)
 {
-    VerifyOrExit(device != nullptr, ChipLogError(DeviceLayer, "device is NULL in %s", __func__));
+    BluezDevice1 * device    = apParams->mDevice;
+    BluezEndpoint * endpoint = apParams->mEndpoint;
+
+    assert(device != nullptr);
+    assert(endpoint != nullptr);
 
-    bluez_device1_call_connect(device, nullptr, ConnectDeviceDone, nullptr);
+    g_cancellable_reset(endpoint->mpConnectCancellable);
+    bluez_device1_call_connect(device, endpoint->mpConnectCancellable, ConnectDeviceDone, nullptr);
     g_object_unref(device);
+    chip::Platform::Delete(apParams);
 
-exit:
     return G_SOURCE_REMOVE;
 }
 
-CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice)
+CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice, BluezEndpoint * apEndpoint)
 {
-    CHIP_ERROR error = CHIP_NO_ERROR;
+    auto params = chip::Platform::New<ConnectParams>(apDevice, apEndpoint);
     g_object_ref(apDevice);
 
-    if (!MainLoop::Instance().Schedule(ConnectDeviceImpl, apDevice))
+    if (!MainLoop::Instance().Schedule(ConnectDeviceImpl, params))
     {
         ChipLogError(Ble, "Failed to schedule ConnectDeviceImpl() on CHIPoBluez thread");
         g_object_unref(apDevice);
-        error = CHIP_ERROR_INCORRECT_STATE;
+        chip::Platform::Delete(params);
+        return CHIP_ERROR_INCORRECT_STATE;
     }
 
-    return error;
+    return CHIP_NO_ERROR;
+}
+
+void CancelConnect(BluezEndpoint * apEndpoint)
+{
+    assert(apEndpoint->mpConnectCancellable != nullptr);
+    g_cancellable_cancel(apEndpoint->mpConnectCancellable);
 }
 
 } // namespace Internal
index 76c60f1..e77ffc9 100644 (file)
@@ -74,7 +74,8 @@ bool BluezSubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn);
 /// Unsubscribe from the CHIP TX characteristic on the remote peripheral device
 bool BluezUnsubscribeCharacteristic(BLE_CONNECTION_OBJECT apConn);
 
-CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice);
+CHIP_ERROR ConnectDevice(BluezDevice1 * apDevice, BluezEndpoint * apEndpoint);
+void CancelConnect(BluezEndpoint * apEndpoint);
 
 } // namespace Internal
 } // namespace DeviceLayer
index fea2358..50cb1f8 100644 (file)
@@ -164,6 +164,7 @@ struct BluezEndpoint
     uint16_t mDuration; ///< Advertisement interval (in ms).
     bool mIsAdvertising;
     char * mpPeerDevicePath;
+    GCancellable * mpConnectCancellable = nullptr;
 };
 
 struct BluezConnection
index cd92004..8886ebe 100644 (file)
@@ -50,7 +50,6 @@
 #include <platform/internal/CHIPDeviceLayerInternal.h>
 #include <platform/internal/DeviceNetworkInfo.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 extern "C" void otSysProcessDrivers(otInstance * aInstance);
@@ -1256,9 +1255,13 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetupSrpHost(co
     VerifyOrExit(aHostName, error = CHIP_ERROR_INVALID_ARGUMENT);
     VerifyOrExit(strlen(aHostName) < SrpClient::kMaxHostNameSize, error = CHIP_ERROR_INVALID_STRING_LENGTH);
 
-    memcpy(mSrpClient.mHostName, aHostName, strlen(aHostName) + 1);
-    error = MapOpenThreadError(otSrpClientSetHostName(mOTInst, aHostName));
-    SuccessOrExit(error);
+    // Avoid adding the same host name multiple times
+    if (strcmp(mSrpClient.mHostName, aHostName) != 0)
+    {
+        strcpy(mSrpClient.mHostName, aHostName);
+        error = MapOpenThreadError(otSrpClientSetHostName(mOTInst, aHostName));
+        SuccessOrExit(error);
+    }
 
     // Check if device has any external IPv6 assigned. If not, host will be set without IPv6 addresses
     // and updated later on.
index 8982f33..dfbc671 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <platform/KeyValueStoreManager.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 
 #include <logging/log.h>
index 7cb8bb4..775e205 100644 (file)
@@ -48,6 +48,8 @@ declare_args() {
 
   if (chip_device_platform == "linux" || chip_device_platform == "esp32") {
     chip_mdns = "minimal"
+  } else if (chip_device_platform == "darwin") {
+    chip_mdns = "platform"
   } else {
     chip_mdns = "none"
   }
index 538e95e..9b2ebb0 100644 (file)
@@ -33,7 +33,7 @@ if (chip_device_platform != "none") {
     }
 
     if (chip_mdns != "none" && chip_enable_happy_tests &&
-        chip_device_platform == "linux") {
+        (chip_device_platform == "linux" || chip_device_platform == "darwin")) {
       test_sources += [ "TestMdns.cpp" ]
     }
 
index aee1658..832ca6a 100644 (file)
@@ -30,5 +30,6 @@ static_library("protocols") {
     "${chip_root}/src/lib/support",
     "${chip_root}/src/messaging",
     "${chip_root}/src/protocols/bdx",
+    "${chip_root}/src/protocols/secure_channel",
   ]
 }
index 321f7ce..f546b00 100644 (file)
@@ -32,27 +32,56 @@ namespace Protocols {
 //
 // CHIP Protocol Ids (32-bits max)
 //
-
-enum CHIPProtocolId
+class Id
 {
-    // Common Protocols
-    //
-    // NOTE: Do not attempt to allocate these values yourself.
-
-    kProtocol_SecureChannel       = (kChipVendor_Common << 16) | 0x0000, // Secure Channel Protocol
-    kProtocol_Echo                = (kChipVendor_Common << 16) | 0x0002, // Echo Protocol
-    kProtocol_BDX                 = (kChipVendor_Common << 16) | 0x0003, // Bulk Data Exchange Protocol
-    kProtocol_NetworkProvisioning = (kChipVendor_Common << 16) | 0x0004, // Network Provisioning Protocol
-    kProtocol_InteractionModel    = (kChipVendor_Common << 16) | 0x0005, // Interaction Model Protocol
-    kProtocol_FabricProvisioning  = (kChipVendor_Common << 16) | 0x0006, // Fabric Provisioning Protocol
-    kProtocol_ServiceProvisioning = (kChipVendor_Common << 16) | 0x0007, // Service Provisioning Protocol
-    kProtocol_OpCredentials       = (kChipVendor_Common << 16) | 0x0008, // Operational Credentials
-
-    // Protocols reserved for internal protocol use
-
-    kProtocol_NotSpecified = (kChipVendor_NotSpecified << 16) | 0xFFFF, // The profile ID is either not specified or a wildcard
+public:
+    constexpr Id(VendorId aVendorId, uint16_t aProtocolId) : mVendorId(aVendorId), mProtocolId(aProtocolId) {}
+
+    constexpr bool operator==(const Id & aOther) { return mVendorId == aOther.mVendorId && mProtocolId == aOther.mProtocolId; }
+
+    // Convert the Protocols::Id to a TLV profile id.
+    // NOTE: We may want to change the TLV reader/writer to take Protocols::Id
+    // directly later on and get rid of this method.
+    constexpr uint32_t ToTLVProfileId() const { return ToUint32(); }
+
+    // Convert the protocol id to a 32-bit unsigned integer "fully qualified"
+    // form as defined in the spec.  This should only be used in the places
+    // where the spec defines a 32-bit unsigned in as a wire representation of
+    // protocol id.
+    constexpr uint32_t ToFullyQualifiedSpecForm() const { return ToUint32(); }
+
+    constexpr VendorId GetVendorId() const { return mVendorId; }
+    constexpr uint16_t GetProtocolId() const { return mProtocolId; }
+
+private:
+    constexpr uint32_t ToUint32() const { return (static_cast<uint32_t>(mVendorId) << 16) | mProtocolId; }
+
+    chip::VendorId mVendorId;
+    uint16_t mProtocolId;
 };
 
+// Common Protocols
+//
+// NOTE: Do not attempt to allocate these values yourself.
+#define CHIP_STANDARD_PROTOCOL(name, id)                                                                                           \
+    namespace name {                                                                                                               \
+    static constexpr Protocols::Id Id(VendorId::Common, id);                                                                       \
+    } // namespace name.
+
+CHIP_STANDARD_PROTOCOL(SecureChannel, 0x0000)       // Secure Channel Protocol
+CHIP_STANDARD_PROTOCOL(Echo, 0x0002)                // Echo Protocol
+CHIP_STANDARD_PROTOCOL(BDX, 0x0003)                 // Bulk Data Exchange Protocol
+CHIP_STANDARD_PROTOCOL(NetworkProvisioning, 0x0004) // Network Provisioning Protocol
+CHIP_STANDARD_PROTOCOL(InteractionModel, 0x0005)    // Interaction Model Protocol
+CHIP_STANDARD_PROTOCOL(FabricProvisioning, 0x0006)  // Fabric Provisioning Protocol
+CHIP_STANDARD_PROTOCOL(ServiceProvisioning, 0x0007) // Service Provisioning Protocol
+CHIP_STANDARD_PROTOCOL(OpCredentials, 0x0008)       // Operational Credentials
+
+#undef CHIP_STANDARD_PROTOCOL
+
+// Protocols reserved for internal protocol use
+static constexpr Id NotSpecified(VendorId::NotSpecified, 0xFFFF); // The profile ID is either not specified or a wildcard
+
 // Pre-delare our MessageTypeTraits so message type headers know what they are
 // specializing.
 template <typename T>
index b1786f6..fe39bcc 100644 (file)
@@ -29,6 +29,7 @@ static_library("bdx") {
   public_deps = [
     "${chip_root}/src/lib/core",
     "${chip_root}/src/lib/support",
+    "${chip_root}/src/protocols/secure_channel",
     "${chip_root}/src/system",
     "${chip_root}/src/transport",
   ]
index ccef89f..e65fd8c 100644 (file)
@@ -55,8 +55,8 @@ enum class StatusCode : uint16_t
     kLengthRequired             = 0x0015,
     kBadMessageContents         = 0x0016,
     kBadBlockCounter            = 0x0017,
+    kUnexpectedMessage          = 0x0018,
     kTransferFailedUnknownError = 0x001F,
-    kServerBadState             = 0x0020,
     kFailureToSend              = 0x0021,
     kTransferMethodNotSupported = 0x0050,
     kFileDesignatorUnknown      = 0x0051,
@@ -286,7 +286,7 @@ namespace Protocols {
 template <>
 struct MessageTypeTraits<bdx::MessageType>
 {
-    static constexpr uint16_t ProtocolId = chip::Protocols::kProtocol_BDX;
+    static constexpr const Protocols::Id & ProtocolId() { return BDX::Id; }
 };
 } // namespace Protocols
 
index 49639b4..0cb1888 100644 (file)
@@ -9,15 +9,16 @@
 #include <protocols/Protocols.h>
 #include <protocols/bdx/BdxMessages.h>
 #include <protocols/secure_channel/Constants.h>
+#include <protocols/secure_channel/StatusReport.h>
 #include <support/BufferReader.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <system/SystemPacketBuffer.h>
 #include <transport/SecureSessionMgr.h>
 
+#include <type_traits>
+
 namespace {
-constexpr uint8_t kBdxVersion         = 0;         ///< The version of this implementation of the BDX spec
-constexpr size_t kStatusReportMinSize = 2 + 4 + 2; ///< 16 bits for GeneralCode, 32 bits for ProtocolId, 16 bits for ProtocolCode
+constexpr uint8_t kBdxVersion = 0; ///< The version of this implementation of the BDX spec
 
 /**
  * @brief
@@ -42,7 +43,7 @@ CHIP_ERROR WriteToPacketBuffer(const ::chip::bdx::BdxMessage & msgStruct, ::chip
 
 // We could make this whole method a template, but it's probably smaller code to
 // share the implementation across all message types.
-CHIP_ERROR AttachHeader(uint16_t protocolId, uint8_t msgType, ::chip::System::PacketBufferHandle & msgBuf)
+CHIP_ERROR AttachHeader(chip::Protocols::Id protocolId, uint8_t msgType, ::chip::System::PacketBufferHandle & msgBuf)
 {
     ::chip::PayloadHeader payloadHeader;
 
@@ -58,7 +59,7 @@ exit:
 template <typename MessageType>
 inline CHIP_ERROR AttachHeader(MessageType msgType, ::chip::System::PacketBufferHandle & msgBuf)
 {
-    return AttachHeader(chip::Protocols::MessageTypeTraits<MessageType>::ProtocolId, static_cast<uint8_t>(msgType), msgBuf);
+    return AttachHeader(chip::Protocols::MessageTypeTraits<MessageType>::ProtocolId(), static_cast<uint8_t>(msgType), msgBuf);
 }
 } // anonymous namespace
 
@@ -424,7 +425,7 @@ CHIP_ERROR TransferSession::HandleMessageReceived(System::PacketBufferHandle msg
     err = payloadHeader.DecodeAndConsume(msg);
     SuccessOrExit(err);
 
-    if (payloadHeader.GetProtocolID() == Protocols::kProtocol_BDX)
+    if (payloadHeader.HasProtocol(Protocols::BDX::Id))
     {
         err = HandleBdxMessage(payloadHeader, std::move(msg));
         SuccessOrExit(err);
@@ -504,14 +505,11 @@ CHIP_ERROR TransferSession::HandleStatusReportMessage(PayloadHeader & header, Sy
     mState            = TransferState::kErrorState;
     mAwaitingResponse = false;
 
-    uint16_t generalCode  = 0;
-    uint32_t protocolId   = 0;
-    uint16_t protocolCode = 0;
-    Encoding::LittleEndian::Reader reader(msg->Start(), msg->DataLength());
-    ReturnErrorOnFailure(reader.Read16(&generalCode).Read32(&protocolId).Read16(&protocolCode).StatusCode());
-    VerifyOrReturnError((protocolId == Protocols::kProtocol_BDX), CHIP_ERROR_INVALID_MESSAGE_TYPE);
+    Protocols::SecureChannel::StatusReport report;
+    ReturnErrorOnFailure(report.Parse(std::move(msg)));
+    VerifyOrReturnError((report.GetProtocolId() == Protocols::BDX::Id.ToFullyQualifiedSpecForm()), CHIP_ERROR_INVALID_MESSAGE_TYPE);
 
-    mStatusReportData.statusCode = static_cast<StatusCode>(protocolCode);
+    mStatusReportData.statusCode = static_cast<StatusCode>(report.GetProtocolCode());
 
     mPendingOutput = OutputEventType::kStatusReceived;
 
@@ -523,15 +521,15 @@ void TransferSession::HandleTransferInit(MessageType msgType, System::PacketBuff
     CHIP_ERROR err = CHIP_NO_ERROR;
     TransferInit transferInit;
 
-    VerifyOrExit(mState == TransferState::kAwaitingInitMsg, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mState == TransferState::kAwaitingInitMsg, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     if (mRole == TransferRole::kSender)
     {
-        VerifyOrExit(msgType == MessageType::ReceiveInit, PrepareStatusReport(StatusCode::kServerBadState));
+        VerifyOrExit(msgType == MessageType::ReceiveInit, PrepareStatusReport(StatusCode::kUnexpectedMessage));
     }
     else
     {
-        VerifyOrExit(msgType == MessageType::SendInit, PrepareStatusReport(StatusCode::kServerBadState));
+        VerifyOrExit(msgType == MessageType::SendInit, PrepareStatusReport(StatusCode::kUnexpectedMessage));
     }
 
     err = transferInit.Parse(msgData.Retain());
@@ -569,8 +567,8 @@ void TransferSession::HandleReceiveAccept(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     ReceiveAccept rcvAcceptMsg;
 
-    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = rcvAcceptMsg.Parse(msgData.Retain());
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -607,8 +605,8 @@ void TransferSession::HandleSendAccept(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     SendAccept sendAcceptMsg;
 
-    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kAwaitingAccept, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = sendAcceptMsg.Parse(msgData.Retain());
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -643,9 +641,9 @@ void TransferSession::HandleBlockQuery(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockQuery query;
 
-    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = query.Parse(std::move(msgData));
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -666,9 +664,9 @@ void TransferSession::HandleBlock(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     Block blockMsg;
 
-    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = blockMsg.Parse(msgData.Retain());
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -703,9 +701,9 @@ void TransferSession::HandleBlockEOF(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockEOF blockEOFMsg;
 
-    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kReceiver, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = blockEOFMsg.Parse(msgData.Retain());
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -735,9 +733,9 @@ void TransferSession::HandleBlockAck(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockAck ackMsg;
 
-    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kTransferInProgress, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = ackMsg.Parse(std::move(msgData));
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -758,9 +756,9 @@ void TransferSession::HandleBlockAckEOF(System::PacketBufferHandle msgData)
     CHIP_ERROR err = CHIP_NO_ERROR;
     BlockAckEOF ackMsg;
 
-    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mState == TransferState::kAwaitingEOFAck, PrepareStatusReport(StatusCode::kServerBadState));
-    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kServerBadState));
+    VerifyOrExit(mRole == TransferRole::kSender, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mState == TransferState::kAwaitingEOFAck, PrepareStatusReport(StatusCode::kUnexpectedMessage));
+    VerifyOrExit(mAwaitingResponse, PrepareStatusReport(StatusCode::kUnexpectedMessage));
 
     err = ackMsg.Parse(std::move(msgData));
     VerifyOrExit(err == CHIP_NO_ERROR, PrepareStatusReport(StatusCode::kBadMessageContents));
@@ -846,15 +844,17 @@ CHIP_ERROR TransferSession::VerifyProposedMode(const BitFlags<TransferControlFla
 
 void TransferSession::PrepareStatusReport(StatusCode code)
 {
-    mStatusReportData.statusCode = code;
+    static_assert(std::is_same<std::underlying_type_t<decltype(code)>, uint16_t>::value, "Cast is not safe");
 
-    Encoding::LittleEndian::PacketBufferWriter bbuf(chip::MessagePacketBuffer::New(kStatusReportMinSize), kStatusReportMinSize);
-    VerifyOrReturn(!bbuf.IsNull());
+    mStatusReportData.statusCode = code;
 
-    bbuf.Put16(static_cast<uint16_t>(Protocols::SecureChannel::GeneralStatusCode::kFailure));
-    bbuf.Put32(Protocols::kProtocol_BDX);
-    bbuf.Put16(static_cast<uint16_t>(mStatusReportData.statusCode));
+    Protocols::SecureChannel::StatusReport report(Protocols::SecureChannel::GeneralStatusCode::kFailure,
+                                                  Protocols::BDX::Id.ToFullyQualifiedSpecForm(), static_cast<uint16_t>(code));
+    size_t msgSize = report.Size();
+    Encoding::LittleEndian::PacketBufferWriter bbuf(chip::MessagePacketBuffer::New(msgSize), msgSize);
+    VerifyOrExit(!bbuf.IsNull(), mPendingOutput = OutputEventType::kInternalError);
 
+    report.WriteToBuffer(bbuf);
     mPendingMsgHandle = bbuf.Finalize();
     if (mPendingMsgHandle.IsNull())
     {
@@ -863,11 +863,11 @@ void TransferSession::PrepareStatusReport(StatusCode code)
     else
     {
         CHIP_ERROR err = AttachHeader(Protocols::SecureChannel::MsgType::StatusReport, mPendingMsgHandle);
-        VerifyOrReturn(err == CHIP_NO_ERROR);
-
+        VerifyOrExit(err == CHIP_NO_ERROR, mPendingOutput = OutputEventType::kInternalError);
         mPendingOutput = OutputEventType::kMsgToSend;
     }
 
+exit:
     mState            = TransferState::kErrorState;
     mAwaitingResponse = false; // Prevent triggering timeout
 }
index a3b5688..1dbf834 100644 (file)
@@ -8,15 +8,16 @@
 
 #include <core/CHIPTLV.h>
 #include <protocols/secure_channel/Constants.h>
+#include <protocols/secure_channel/StatusReport.h>
 #include <support/BufferReader.h>
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/UnitTestRegistration.h>
 #include <system/SystemPacketBuffer.h>
 
 using namespace ::chip;
 using namespace ::chip::bdx;
+using namespace ::chip::Protocols;
 
 namespace {
 // Use this as a timestamp if not needing to test BDX timeouts.
@@ -112,12 +113,8 @@ void VerifyBdxMessageType(nlTestSuite * inSuite, void * inContext, const System:
 // Helper method for verifying that a PacketBufferHandle contains a valid StatusReport message and contains a specific StatusCode.
 void VerifyStatusReport(nlTestSuite * inSuite, void * inContext, const System::PacketBufferHandle & msg, StatusCode code)
 {
-    CHIP_ERROR err      = CHIP_NO_ERROR;
-    uint16_t headerSize = 0;
+    CHIP_ERROR err = CHIP_NO_ERROR;
     PayloadHeader payloadHeader;
-    uint16_t generalCode = 0;
-    uint32_t protocolId  = 0;
-    BitFlags<StatusCode> protocolCode;
 
     if (msg.IsNull())
     {
@@ -125,21 +122,23 @@ void VerifyStatusReport(nlTestSuite * inSuite, void * inContext, const System::P
         return;
     }
 
-    err = payloadHeader.Decode(msg->Start(), msg->DataLength(), &headerSize);
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::StatusReport));
-    if (headerSize > msg->DataLength())
+    System::PacketBufferHandle msgCopy = msg.CloneData();
+    if (msgCopy.IsNull())
     {
         NL_TEST_ASSERT(inSuite, false);
         return;
     }
 
-    Encoding::LittleEndian::Reader reader(msg->Start(), msg->DataLength());
-    err = reader.Skip(headerSize).Read16(&generalCode).Read32(&protocolId).Read16(protocolCode.RawStorage()).StatusCode();
+    err = payloadHeader.DecodeAndConsume(msgCopy);
+    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    NL_TEST_ASSERT(inSuite, payloadHeader.HasMessageType(SecureChannel::MsgType::StatusReport));
+
+    SecureChannel::StatusReport report;
+    err = report.Parse(std::move(msgCopy));
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, generalCode == static_cast<uint16_t>(Protocols::SecureChannel::GeneralStatusCode::kFailure));
-    NL_TEST_ASSERT(inSuite, protocolId == Protocols::kProtocol_BDX);
-    NL_TEST_ASSERT(inSuite, protocolCode == code);
+    NL_TEST_ASSERT(inSuite, report.GetGeneralCode() == SecureChannel::GeneralStatusCode::kFailure);
+    NL_TEST_ASSERT(inSuite, report.GetProtocolId() == Protocols::BDX::Id.ToFullyQualifiedSpecForm());
+    NL_TEST_ASSERT(inSuite, report.GetProtocolCode() == static_cast<uint16_t>(code));
 }
 
 void VerifyNoMoreOutput(nlTestSuite * inSuite, void * inContext, TransferSession & transferSession)
index 271f512..02f3535 100644 (file)
@@ -154,7 +154,7 @@ private:
 template <>
 struct MessageTypeTraits<Echo::MsgType>
 {
-    static constexpr uint16_t ProtocolId = chip::Protocols::kProtocol_Echo;
+    static constexpr const Protocols::Id & ProtocolId() { return Echo::Id; }
 };
 
 } // namespace Protocols
index 8dd6e27..bed0119 100644 (file)
@@ -60,7 +60,7 @@ enum class MsgType : uint8_t
 template <>
 struct MessageTypeTraits<InteractionModel::MsgType>
 {
-    static constexpr uint16_t ProtocolId = chip::Protocols::kProtocol_InteractionModel;
+    static constexpr const Protocols::Id & ProtocolId() { return InteractionModel::Id; }
 };
 
 } // namespace Protocols
diff --git a/src/protocols/secure_channel/BUILD.gn b/src/protocols/secure_channel/BUILD.gn
new file mode 100644 (file)
index 0000000..4eebcc8
--- /dev/null
@@ -0,0 +1,18 @@
+import("//build_overrides/chip.gni")
+
+static_library("secure_channel") {
+  output_name = "libSecureChannel"
+
+  sources = [
+    "StatusReport.cpp",
+    "StatusReport.h",
+  ]
+
+  cflags = [ "-Wconversion" ]
+
+  public_deps = [
+    "${chip_root}/src/lib/core",
+    "${chip_root}/src/lib/support",
+    "${chip_root}/src/system",
+  ]
+}
index 0d44f3e..303244c 100644 (file)
@@ -116,7 +116,7 @@ enum class StatusCode
 template <>
 struct MessageTypeTraits<SecureChannel::MsgType>
 {
-    static constexpr uint16_t ProtocolId = chip::Protocols::kProtocol_SecureChannel;
+    static constexpr const Protocols::Id & ProtocolId() { return SecureChannel::Id; }
 };
 
 } // namespace Protocols
diff --git a/src/protocols/secure_channel/StatusReport.cpp b/src/protocols/secure_channel/StatusReport.cpp
new file mode 100644 (file)
index 0000000..73ade99
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <protocols/secure_channel/Constants.h>
+#include <protocols/secure_channel/StatusReport.h>
+
+#include <support/BufferReader.h>
+#include <support/CodeUtils.h>
+
+#include <type_traits>
+
+using namespace chip::Encoding;
+using GeneralStatusCode = chip::Protocols::SecureChannel::GeneralStatusCode;
+
+namespace chip {
+namespace Protocols {
+namespace SecureChannel {
+
+StatusReport::StatusReport() : mGeneralCode(GeneralStatusCode::kSuccess), mProtocolId(0), mProtocolCode(0), mProtocolData(nullptr)
+{}
+
+StatusReport::StatusReport(GeneralStatusCode generalCode, uint32_t protocolId, uint16_t protocolCode) :
+    mGeneralCode(generalCode), mProtocolId(protocolId), mProtocolCode(protocolCode), mProtocolData(nullptr)
+{}
+
+StatusReport::StatusReport(GeneralStatusCode generalCode, uint32_t protocolId, uint16_t protocolCode,
+                           System::PacketBufferHandle protocolData) :
+    mGeneralCode(generalCode),
+    mProtocolId(protocolId), mProtocolCode(protocolCode), mProtocolData(std::move(protocolData))
+{}
+
+CHIP_ERROR StatusReport::Parse(System::PacketBufferHandle buf)
+{
+    uint16_t tempGeneralCode = 0;
+
+    ReturnErrorCodeIf(buf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT);
+
+    uint8_t * bufStart = buf->Start();
+    LittleEndian::Reader bufReader(bufStart, buf->DataLength());
+
+    ReturnErrorOnFailure(bufReader.Read16(&tempGeneralCode).Read32(&mProtocolId).Read16(&mProtocolCode).StatusCode());
+    mGeneralCode = static_cast<GeneralStatusCode>(tempGeneralCode);
+
+    // Any data that exists after the required fields is considered protocol-specific data.
+    if (bufReader.OctetsRead() < buf->DataLength())
+    {
+        mProtocolData = System::PacketBufferHandle::NewWithData(buf->Start() + bufReader.OctetsRead(),
+                                                                buf->DataLength() - bufReader.OctetsRead(),
+                                                                /* aAdditionalSize = */ 0, /* aReservedSize = */ 0);
+        if (mProtocolData.IsNull())
+        {
+            return CHIP_ERROR_NO_MEMORY;
+        }
+    }
+    else
+    {
+        mProtocolData = nullptr;
+    }
+
+    return CHIP_NO_ERROR;
+}
+
+Encoding::LittleEndian::BufferWriter & StatusReport::WriteToBuffer(Encoding::LittleEndian::BufferWriter & buf) const
+{
+    static_assert(std::is_same<std::underlying_type_t<decltype(mGeneralCode)>, uint16_t>::value, "Cast is not safe");
+    buf.Put16(static_cast<uint16_t>(mGeneralCode)).Put32(mProtocolId).Put16(mProtocolCode);
+    if (!mProtocolData.IsNull())
+    {
+        buf.Put(mProtocolData->Start(), mProtocolData->DataLength());
+    }
+    return buf;
+}
+
+size_t StatusReport::Size() const
+{
+    LittleEndian::BufferWriter emptyBuf(nullptr, 0);
+    return WriteToBuffer(emptyBuf).Needed();
+}
+
+} // namespace SecureChannel
+} // namespace Protocols
+} // namespace chip
diff --git a/src/protocols/secure_channel/StatusReport.h b/src/protocols/secure_channel/StatusReport.h
new file mode 100644 (file)
index 0000000..3c9dbcd
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#pragma once
+
+#include <support/BufferWriter.h>
+#include <system/SystemPacketBuffer.h>
+
+namespace chip {
+namespace Protocols {
+namespace SecureChannel {
+
+/**
+ *  Encapsulates the data included in a StatusReport message, and provides methods for writing to and reading from PacketBuffers
+ *  that contain StatusReport messages.
+ */
+class DLL_EXPORT StatusReport
+{
+public:
+    /**
+     *  Construct a StatusReport with zero-d out fields (for use before calling \c Parse() ).
+     */
+    StatusReport();
+
+    /**
+     *  Construct a StatusReport with no additional ProtocolData.
+     *
+     *  @param generalCode Required, one of the \c GeneralStatusCode values listed in \c secure_channel/Constants.h
+     *  @param protocolId Must specify a ProtocolId which consists of Vendor Id (upper 16 bits) and ProtocolId (lower 16 bits)
+     *  @param protocolCode A code defined by the specified protocol which provides more information about the status
+     */
+    StatusReport(GeneralStatusCode generalCode, uint32_t protocolId, uint16_t protocolCode);
+
+    //
+    /**
+     *  Construct a StatusReport with additional ProtocolData.
+     *
+     *  @param generalCode Must specify a GeneralCode (see \c GeneralStatusCode )
+     *  @param protocolId Must specify a ProtocolId which consists of Vendor Id (upper 16 bits) and ProtocolId (lower 16 bits)
+     *  @param protocolCode A code defined by the specified protocol which provides more information about the status
+     *  @param protocolData A \c PacketBufferHandle containing the protocol-specific data
+     */
+    StatusReport(GeneralStatusCode generalCode, uint32_t protocolId, uint16_t protocolCode,
+                 System::PacketBufferHandle protocolData);
+
+    /**
+     *  Read the contents of a \c PacketBuffer containing a StatusReport message and store the field values in this object.
+     *
+     *  @note If there is additional data after the Protocol Code field in the message, it is assumed to be protocol-specific data.
+     *
+     *  @note This method assumes that the Header of the message has already been consumed, and that \c PacketBuffer::Start() points
+     *  to the beginning of the StatusReport data.
+     *
+     *  @param[in] buf A \c PacketBufferHandle containing the StatusReport message. This method will take ownership, and will
+     *                 allocate a new PacketBuffer if any protocol-specific data exists.
+     *
+     *  @return CHIP_ERROR Return an error if the message is malformed or buf is \c NULL
+     */
+    CHIP_ERROR Parse(System::PacketBufferHandle buf);
+
+    /**
+     *  Write the StatusReport contents into a buffer using a \c BufferWriter
+     *
+     *  @param[out] buf A \c BufferWriter which contains the buffer that will store the message fields.
+     *
+     *  @return BufferWriter Return a reference to the \c BufferWriter
+     */
+    Encoding::LittleEndian::BufferWriter & WriteToBuffer(Encoding::LittleEndian::BufferWriter & buf) const;
+
+    /**
+     *  Returns the minimum size of the buffer needed to write the message.
+     */
+    size_t Size() const;
+
+    GeneralStatusCode GetGeneralCode() const { return mGeneralCode; }
+    uint32_t GetProtocolId() const { return mProtocolId; }
+    uint16_t GetProtocolCode() const { return mProtocolCode; }
+    const System::PacketBufferHandle & GetProtocolData() const { return mProtocolData; }
+
+private:
+    GeneralStatusCode mGeneralCode;
+    uint32_t mProtocolId;
+    uint16_t mProtocolCode;
+
+    System::PacketBufferHandle mProtocolData;
+};
+
+} // namespace SecureChannel
+} // namespace Protocols
+} // namespace chip
diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn
new file mode 100644 (file)
index 0000000..3ea6f7b
--- /dev/null
@@ -0,0 +1,22 @@
+import("//build_overrides/build.gni")
+import("//build_overrides/chip.gni")
+import("//build_overrides/nlio.gni")
+import("//build_overrides/nlunit_test.gni")
+
+import("${chip_root}/build/chip/chip_test_suite.gni")
+
+chip_test_suite("tests") {
+  output_name = "libSecureChannelTests"
+
+  test_sources = [ "TestStatusReport.cpp" ]
+
+  public_deps = [
+    "${chip_root}/src/lib/core",
+    "${chip_root}/src/lib/support",
+    "${chip_root}/src/protocols/secure_channel",
+    "${nlio_root}:nlio",
+    "${nlunit_test_root}:nlunit-test",
+  ]
+
+  cflags = [ "-Wconversion" ]
+}
diff --git a/src/protocols/secure_channel/tests/TestStatusReport.cpp b/src/protocols/secure_channel/tests/TestStatusReport.cpp
new file mode 100644 (file)
index 0000000..102b251
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ *
+ *    Copyright (c) 2021 Project CHIP Authors
+ *    All rights reserved.
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <protocols/Protocols.h>
+#include <protocols/secure_channel/Constants.h>
+#include <protocols/secure_channel/StatusReport.h>
+#include <support/BufferWriter.h>
+#include <support/CHIPMem.h>
+#include <support/UnitTestRegistration.h>
+#include <system/SystemPacketBuffer.h>
+
+#include <nlunit-test.h>
+
+using namespace chip;
+using namespace chip::Protocols;
+using namespace chip::Protocols::SecureChannel;
+
+void TestStatusReport_NoData(nlTestSuite * inSuite, void * inContext)
+{
+    GeneralStatusCode generalCode = GeneralStatusCode::kSuccess;
+    uint32_t protocolId           = SecureChannel::Id.ToFullyQualifiedSpecForm();
+    uint16_t protocolCode         = kProtocolCodeSuccess;
+
+    StatusReport testReport(generalCode, protocolId, protocolCode);
+
+    size_t msgSize = testReport.Size();
+    Encoding::LittleEndian::PacketBufferWriter bbuf(System::PacketBufferHandle::New(msgSize));
+    testReport.WriteToBuffer(bbuf);
+
+    System::PacketBufferHandle msgBuf = bbuf.Finalize();
+    NL_TEST_ASSERT(inSuite, !msgBuf.IsNull());
+
+    StatusReport reportToParse;
+    CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf));
+    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode);
+
+    const System::PacketBufferHandle & data = reportToParse.GetProtocolData();
+    NL_TEST_ASSERT(inSuite, data.IsNull());
+}
+
+void TestStatusReport_WithData(nlTestSuite * inSuite, void * inContext)
+{
+    GeneralStatusCode generalCode      = GeneralStatusCode::kFailure;
+    uint32_t protocolId                = SecureChannel::Id.ToFullyQualifiedSpecForm();
+    uint16_t protocolCode              = static_cast<uint16_t>(StatusCode::InvalidFabricConfig);
+    uint8_t data[6]                    = { 42, 19, 3, 1, 3, 0 };
+    const uint16_t dataLen             = 6;
+    System::PacketBufferHandle dataBuf = System::PacketBufferHandle::NewWithData(data, dataLen);
+
+    StatusReport testReport(generalCode, protocolId, protocolCode, std::move(dataBuf));
+
+    size_t msgSize = testReport.Size();
+    Encoding::LittleEndian::PacketBufferWriter bbuf(System::PacketBufferHandle::New(msgSize));
+    testReport.WriteToBuffer(bbuf);
+
+    System::PacketBufferHandle msgBuf = bbuf.Finalize();
+    NL_TEST_ASSERT(inSuite, !msgBuf.IsNull());
+
+    StatusReport reportToParse;
+    CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf));
+    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId);
+    NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode);
+
+    const System::PacketBufferHandle & rcvData = reportToParse.GetProtocolData();
+    if (rcvData.IsNull())
+    {
+        NL_TEST_ASSERT(inSuite, false);
+        return;
+    }
+    NL_TEST_ASSERT(inSuite, rcvData->DataLength() == dataLen);
+    NL_TEST_ASSERT(inSuite, !memcmp(rcvData->Start(), data, dataLen));
+}
+
+void TestBadStatusReport(nlTestSuite * inSuite, void * inContext)
+{
+    StatusReport report;
+    System::PacketBufferHandle badMsg = System::PacketBufferHandle::New(10);
+    CHIP_ERROR err                    = report.Parse(std::move(badMsg));
+    NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR);
+
+    StatusReport report2;
+    badMsg = nullptr;
+    err    = report2.Parse(std::move(badMsg));
+    NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR);
+}
+
+// Test Suite
+
+/**
+ *  Test Suite that lists all the test functions.
+ */
+// clang-format off
+static const nlTest sTests[] =
+{
+    NL_TEST_DEF("TestStatusReport_NoData", TestStatusReport_NoData),
+    NL_TEST_DEF("TestStatusReport_WithData", TestStatusReport_WithData),
+    NL_TEST_DEF("TestBadStatusReport", TestBadStatusReport),
+
+    NL_TEST_SENTINEL()
+};
+// clang-format on
+
+/**
+ *  Set up the test suite.
+ */
+static int TestSetup(void * inContext)
+{
+    CHIP_ERROR error = chip::Platform::MemoryInit();
+    if (error != CHIP_NO_ERROR)
+        return FAILURE;
+    return SUCCESS;
+}
+
+/**
+ *  Tear down the test suite.
+ */
+static int TestTeardown(void * inContext)
+{
+    chip::Platform::MemoryShutdown();
+    return SUCCESS;
+}
+
+// clang-format off
+static nlTestSuite sSuite =
+{
+    "Test-CHIP-StatusReport",
+    &sTests[0],
+    TestSetup,
+    TestTeardown,
+};
+// clang-format on
+
+/**
+ *  Main
+ */
+int TestStatusReport()
+{
+    // Run test suit against one context
+    nlTestRunner(&sSuite, nullptr);
+
+    return (nlTestRunnerStats(&sSuite));
+}
+
+CHIP_REGISTER_TEST_SUITE(TestStatusReport)
index 7583b99..a0a1cb7 100644 (file)
@@ -36,7 +36,6 @@
 #include <protocols/Protocols.h>
 #include <support/CodeUtils.h>
 #include <support/RandUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <support/ScopedBuffer.h>
 
index c96ce9c..0727a5c 100644 (file)
@@ -635,7 +635,7 @@ PacketBufferHandle PacketBufferHandle::PopHead()
     return PacketBufferHandle(head);
 }
 
-PacketBufferHandle PacketBufferHandle::CloneData()
+PacketBufferHandle PacketBufferHandle::CloneData() const
 {
     PacketBufferHandle cloneHead;
 
index 6b15249..13854a0 100644 (file)
@@ -653,7 +653,7 @@ public:
      *
      * @returns empty handle on allocation failure. Otherwise, the returned buffer has the same sizes and contents as the original.
      */
-    PacketBufferHandle CloneData();
+    PacketBufferHandle CloneData() const;
 
     /**
      * Perform an implementation-defined check on the validity of a PacketBufferHandle.
index e3a7de9..6a61834 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <core/CHIPEncoding.h>
 #include <support/CHIPMem.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/AdminPairingTable.h>
 
index 6364cf9..47ca32c 100644 (file)
@@ -25,7 +25,6 @@
 #include <transport/BLE.h>
 
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 #include <transport/raw/MessageHeader.h>
 
index 8ab738f..3c6d0ff 100644 (file)
@@ -33,7 +33,6 @@
 #include <protocols/Protocols.h>
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/SecureSessionMgr.h>
 
@@ -357,7 +356,7 @@ CHIP_ERROR CASESession::HandlePeerMessage(const PacketHeader & packetHeader, con
     err = payloadHeader.DecodeAndConsume(msg);
     SuccessOrExit(err);
 
-    VerifyOrExit(payloadHeader.GetProtocolID() == Protocols::kProtocol_SecureChannel, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
+    VerifyOrExit(payloadHeader.HasProtocol(Protocols::SecureChannel::Id), err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
 
     msgType = static_cast<Protocols::SecureChannel::MsgType>(payloadHeader.GetMessageType());
     VerifyOrExit(msgType == mNextExpectedMsg, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
index 22abe28..e1dfabf 100644 (file)
@@ -188,7 +188,7 @@ CHIP_ERROR NetworkProvisioning::SendIPAddress(const Inet::IPAddress & addr)
     VerifyOrExit(mDelegate != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
     VerifyOrExit(addrStr != nullptr, err = CHIP_ERROR_INVALID_ADDRESS);
 
-    err = mDelegate->SendSecureMessage(Protocols::kProtocol_NetworkProvisioning, NetworkProvisioning::MsgTypes::kIPAddressAssigned,
+    err = mDelegate->SendSecureMessage(Protocols::NetworkProvisioning::Id, NetworkProvisioning::MsgTypes::kIPAddressAssigned,
                                        std::move(buffer));
     SuccessOrExit(err);
 
@@ -233,7 +233,7 @@ CHIP_ERROR NetworkProvisioning::SendNetworkCredentials(const char * ssid, const
         SuccessOrExit(EncodeString(passwd, bbuf));
         VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_BUFFER_TOO_SMALL);
 
-        err = mDelegate->SendSecureMessage(Protocols::kProtocol_NetworkProvisioning,
+        err = mDelegate->SendSecureMessage(Protocols::NetworkProvisioning::Id,
                                            NetworkProvisioning::MsgTypes::kWiFiAssociationRequest, bbuf.Finalize());
         SuccessOrExit(err);
     }
@@ -276,8 +276,8 @@ CHIP_ERROR NetworkProvisioning::SendThreadCredentials(const DeviceLayer::Interna
     bbuf.Put(static_cast<uint8_t>(threadData.FieldPresent.ThreadPSKc));
 
     VerifyOrExit(bbuf.Fit(), err = CHIP_ERROR_BUFFER_TOO_SMALL);
-    err = mDelegate->SendSecureMessage(Protocols::kProtocol_NetworkProvisioning,
-                                       NetworkProvisioning::MsgTypes::kThreadAssociationRequest, bbuf.Finalize());
+    err = mDelegate->SendSecureMessage(Protocols::NetworkProvisioning::Id, NetworkProvisioning::MsgTypes::kThreadAssociationRequest,
+                                       bbuf.Finalize());
 
 exit:
     if (CHIP_NO_ERROR != err)
index 3c6af2a..2808063 100644 (file)
@@ -48,7 +48,7 @@ public:
      * @param msgBuf the new message that should be sent to the peer
      * @return CHIP_ERROR Error thrown when sending the message
      */
-    virtual CHIP_ERROR SendSecureMessage(Protocols::CHIPProtocolId protocol, uint8_t msgType, System::PacketBufferHandle msgBuf)
+    virtual CHIP_ERROR SendSecureMessage(Protocols::Id protocol, uint8_t msgType, System::PacketBufferHandle msgBuf)
     {
         return CHIP_NO_ERROR;
     }
index f5fa36a..7f61424 100644 (file)
 #include <core/CHIPEncoding.h>
 #include <core/CHIPSafeCasts.h>
 #include <protocols/Protocols.h>
+#include <protocols/secure_channel/Constants.h>
 #include <setup_payload/SetupPayload.h>
 #include <support/BufferWriter.h>
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/SecureSessionMgr.h>
 
@@ -788,8 +788,7 @@ CHIP_ERROR PASESession::HandlePeerMessage(const PacketHeader & packetHeader, con
     err = payloadHeader.DecodeAndConsume(msg);
     SuccessOrExit(err);
 
-    VerifyOrExit(payloadHeader.GetProtocolID() == Protocols::kProtocol_SecureChannel, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
-    VerifyOrExit(payloadHeader.GetMessageType() == (uint8_t) mNextExpectedMsg, err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
+    VerifyOrExit(payloadHeader.HasMessageType(mNextExpectedMsg), err = CHIP_ERROR_INVALID_MESSAGE_TYPE);
 
     mConnectionState.SetPeerAddress(peerAddress);
 
index 371445c..221167c 100644 (file)
@@ -22,7 +22,6 @@
 #include <support/CHIPMem.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/RendezvousSession.h>
 #include <transport/SecureMessageCodec.h>
@@ -155,13 +154,12 @@ CHIP_ERROR RendezvousSession::SendSessionEstablishmentMessage(const PacketHeader
     }
 }
 
-CHIP_ERROR RendezvousSession::SendSecureMessage(Protocols::CHIPProtocolId protocol, uint8_t msgType,
-                                                System::PacketBufferHandle msgBuf)
+CHIP_ERROR RendezvousSession::SendSecureMessage(Protocols::Id protocol, uint8_t msgType, System::PacketBufferHandle msgBuf)
 {
     VerifyOrReturnError(mPairingSessionHandle != nullptr, CHIP_ERROR_INCORRECT_STATE);
 
     PayloadHeader payloadHeader;
-    payloadHeader.SetMessageType(static_cast<uint16_t>(protocol), msgType);
+    payloadHeader.SetMessageType(protocol, msgType);
 
     return mSecureSessionMgr->SendMessage(*mPairingSessionHandle, payloadHeader, std::move(msgBuf));
 }
@@ -415,7 +413,7 @@ CHIP_ERROR RendezvousSession::HandleSecureMessage(const PacketHeader & packetHea
         mParams.SetRemoteNodeId(packetHeader.GetSourceNodeId().Value());
     }
 
-    if (payloadHeader.GetProtocolID() == Protocols::kProtocol_NetworkProvisioning)
+    if (payloadHeader.HasProtocol(Protocols::NetworkProvisioning::Id))
     {
         ReturnErrorOnFailure(mNetworkProvision.HandleNetworkProvisioningMessage(payloadHeader.GetMessageType(), msgBuf));
     }
index 91a312c..8f88bc5 100644 (file)
@@ -125,7 +125,7 @@ public:
     void SendOperationalCredentials() override;
 
     //////////// NetworkProvisioningDelegate Implementation ///////////////
-    CHIP_ERROR SendSecureMessage(Protocols::CHIPProtocolId protocol, uint8_t msgType, System::PacketBufferHandle msgBug) override;
+    CHIP_ERROR SendSecureMessage(Protocols::Id protocol, uint8_t msgType, System::PacketBufferHandle msgBug) override;
     void OnNetworkProvisioningError(CHIP_ERROR error) override;
     void OnNetworkProvisioningComplete() override;
 
index 1fd7af6..1f7e424 100644 (file)
@@ -26,7 +26,6 @@
  */
 
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/SecureMessageCodec.h>
 
index 61de2ce..5d47267 100644 (file)
@@ -25,7 +25,6 @@
 #include <core/CHIPEncoding.h>
 #include <support/BufferWriter.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <transport/SecureSession.h>
 #include <transport/raw/MessageHeader.h>
 
index d8d749f..872a738 100644 (file)
@@ -32,7 +32,6 @@
 #include <core/CHIPKeyIds.h>
 #include <platform/CHIPDeviceLayer.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <support/logging/CHIPLogging.h>
 #include <transport/AdminPairingTable.h>
index 5d5feb8..647b18e 100644 (file)
@@ -16,7 +16,6 @@
  */
 
 #include <core/CHIPEncoding.h>
-#include <support/ReturnMacros.h>
 #include <support/SafeInt.h>
 #include <transport/StorablePeerConnection.h>
 
index 9e05324..79f72bb 100644 (file)
@@ -32,7 +32,6 @@
 #include <core/CHIPError.h>
 #include <support/BufferReader.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 
 /**********************************************
  * Header format (little endian):
index 7e02be0..a587a41 100644 (file)
@@ -322,6 +322,7 @@ private:
 class PayloadHeader
 {
 public:
+    constexpr PayloadHeader() { SetProtocol(Protocols::NotSpecified); }
     PayloadHeader & operator=(const PayloadHeader &) = default;
 
     /**
@@ -335,8 +336,17 @@ public:
     uint16_t GetExchangeID() const { return mExchangeID; }
 
     /** Get the Protocol ID from this header. */
+    // TODO: We should probably get rid of GetProtocolId and the
+    // current form of the mVendorId accessors.
     uint16_t GetProtocolID() const { return mProtocolID; }
 
+    /** Check whether the header has a given protocol */
+    bool HasProtocol(Protocols::Id protocol) const
+    {
+        static_assert(std::is_same<std::underlying_type_t<VendorId>, uint16_t>::value, "Wrong type for VendorId");
+        return mProtocolID == protocol.GetProtocolId() && mVendorId.ValueOr(VendorId::Common) == protocol.GetVendorId();
+    }
+
     /** Get the secure msg type from this header. */
     uint8_t GetMessageType() const { return mMessageType; }
 
@@ -346,7 +356,7 @@ public:
     bool HasMessageType(MessageType type) const
     {
         static_assert(std::is_same<std::underlying_type_t<MessageType>, uint8_t>::value, "Enum is wrong size; cast is not safe");
-        return mProtocolID == Protocols::MessageTypeTraits<MessageType>::ProtocolId && HasMessageType(static_cast<uint8_t>(type));
+        return HasProtocol(Protocols::MessageTypeTraits<MessageType>::ProtocolId()) && HasMessageType(static_cast<uint8_t>(type));
     }
 
     /**
@@ -366,7 +376,7 @@ public:
     }
 
     /** Set the vendor id for this header. */
-    PayloadHeader & SetVendorId(Optional<uint16_t> id)
+    constexpr PayloadHeader & SetVendorId(Optional<uint16_t> id)
     {
         mVendorId = id;
         mExchangeFlags.Set(Header::ExFlagValues::kExchangeFlag_VendorIdPresent, id.HasValue());
@@ -375,9 +385,10 @@ public:
     }
 
     /** Clear the vendor id for this header. */
-    PayloadHeader & ClearVendorId()
+    constexpr PayloadHeader & ClearVendorId()
     {
         mVendorId.ClearValue();
+        mExchangeFlags.Clear(Header::ExFlagValues::kExchangeFlag_VendorIdPresent);
 
         return *this;
     }
@@ -391,9 +402,9 @@ public:
      * message type and hence can't automatically determine the protocol from
      * the message type.
      */
-    PayloadHeader & SetMessageType(uint16_t protocol, uint8_t type)
+    PayloadHeader & SetMessageType(Protocols::Id protocol, uint8_t type)
     {
-        mProtocolID  = protocol;
+        SetProtocol(protocol);
         mMessageType = type;
         return *this;
     }
@@ -404,8 +415,7 @@ public:
     PayloadHeader & SetMessageType(MessageType type)
     {
         static_assert(std::is_same<std::underlying_type_t<MessageType>, uint8_t>::value, "Enum is wrong size; cast is not safe");
-        mMessageType = static_cast<uint8_t>(type);
-        mProtocolID  = Protocols::MessageTypeTraits<MessageType>::ProtocolId;
+        SetMessageType(Protocols::MessageTypeTraits<MessageType>::ProtocolId(), static_cast<uint8_t>(type));
         return *this;
     }
 
@@ -550,6 +560,19 @@ public:
     }
 
 private:
+    constexpr void SetProtocol(Protocols::Id protocol)
+    {
+        if (protocol.GetVendorId() == VendorId::Common)
+        {
+            ClearVendorId();
+        }
+        else
+        {
+            SetVendorId(protocol.GetVendorId());
+        }
+        mProtocolID = protocol.GetProtocolId();
+    }
+
     /// Packet type (application data, security control packets, e.g. pairing,
     /// configuration, rekey etc)
     uint8_t mMessageType = 0;
@@ -561,7 +584,7 @@ private:
     Optional<uint16_t> mVendorId;
 
     /// Protocol identifier
-    uint16_t mProtocolID = static_cast<uint16_t>(Protocols::kProtocol_NotSpecified);
+    uint16_t mProtocolID = 0xFFFF;
 
     /// Bit flag indicators for CHIP Exchange header
     Header::ExFlags mExchangeFlags;
index 07b0a31..b8d8746 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <core/CHIPEncoding.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 #include <transport/raw/MessageHeader.h>
 
@@ -42,6 +41,9 @@ using namespace chip::Encoding;
 // Packets start with a 16-bit size
 constexpr size_t kPacketSizeBytes = 2;
 
+// TODO: Actual limit may be lower (spec issue #2119)
+constexpr uint16_t kMaxMessageSize = static_cast<uint16_t>(System::PacketBuffer::kMaxSizeWithoutReserve - kPacketSizeBytes);
+
 constexpr int kListenBacklogSize = 2;
 
 } // namespace
@@ -286,15 +288,6 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe
     VerifyOrReturnError(state != nullptr, CHIP_ERROR_INTERNAL);
     state->mReceived.AddToEnd(std::move(buffer));
 
-    if (state->mDiscardSize != 0)
-    {
-        CHIP_ERROR err = state->Discard();
-        if ((err != CHIP_NO_ERROR) || (state->mDiscardSize != 0))
-        {
-            return err;
-        }
-    }
-
     while (!state->mReceived.IsNull())
     {
         uint8_t messageSizeBuf[kPacketSizeBytes];
@@ -309,13 +302,9 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe
             return err;
         }
         uint16_t messageSize = LittleEndian::Get16(messageSizeBuf);
-        if (messageSize >= System::PacketBuffer::kMaxSizeWithoutReserve)
+        if (messageSize >= kMaxMessageSize)
         {
-            // This message is too long for upper layers, which require a contiguous buffer.
-            // TODO: Actual limit may be lower (spec issue #2119)
-            state->mReceived.Consume(kPacketSizeBytes);
-            state->mDiscardSize = messageSize;
-            ReturnErrorOnFailure(state->Discard());
+            // This message is too long for upper layers.
             return CHIP_ERROR_MESSAGE_TOO_LONG;
         }
         // The subtraction will not underflow because we successfully read kPacketSizeBytes.
@@ -368,7 +357,7 @@ CHIP_ERROR TCPBase::ProcessSingleMessage(const PeerAddress & peerAddress, Active
     return CHIP_NO_ERROR;
 }
 
-void TCPBase::OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBufferHandle buffer)
+INET_ERROR TCPBase::OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBufferHandle buffer)
 {
     Inet::IPAddress ipAddress;
     uint16_t port;
@@ -382,8 +371,10 @@ void TCPBase::OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBufferHan
     if (err != CHIP_NO_ERROR)
     {
         // Connection could need to be closed at this point
-        ChipLogError(Inet, "Failed to handle received TCP message: %s", ErrorStr(err));
+        ChipLogError(Inet, "Failed to accept received TCP message: %s", ErrorStr(err));
+        return INET_ERROR_UNEXPECTED_EVENT;
     }
+    return INET_NO_ERROR;
 }
 
 void TCPBase::OnConnectionComplete(Inet::TCPEndPoint * endPoint, INET_ERROR inetErr)
index 348585e..6ea5ebc 100644 (file)
@@ -34,7 +34,6 @@
 #include <inet/InetInterface.h>
 #include <inet/TCPEndPoint.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <transport/raw/Base.h>
 
 namespace chip {
@@ -110,17 +109,15 @@ protected:
     {
         void Init(Inet::TCPEndPoint * endPoint)
         {
-            mEndPoint    = endPoint;
-            mReceived    = nullptr;
-            mDiscardSize = 0;
+            mEndPoint = endPoint;
+            mReceived = nullptr;
         }
 
         void Free()
         {
             mEndPoint->Free();
-            mEndPoint    = nullptr;
-            mReceived    = nullptr;
-            mDiscardSize = 0;
+            mEndPoint = nullptr;
+            mReceived = nullptr;
         }
         bool InUse() const { return mEndPoint != nullptr; }
 
@@ -129,23 +126,6 @@ protected:
 
         // Buffers received but not yet consumed.
         System::PacketBufferHandle mReceived;
-
-        // Length of incoming data that must be discard to resynchronize.
-        // TODO: This can be removed once issue #5438 guarantees that the
-        //       connection is closed on any error.
-        uint16_t mDiscardSize;
-        CHIP_ERROR Discard()
-        {
-            VerifyOrReturnError((mDiscardSize != 0) && !mReceived.IsNull(), CHIP_NO_ERROR);
-            uint16_t initialLength = mReceived->TotalLength();
-            mReceived.Consume(mDiscardSize);
-            uint16_t remainingLength = mReceived.IsNull() ? 0 : mReceived->TotalLength();
-            VerifyOrReturnError(remainingLength <= initialLength, CHIP_ERROR_INTERNAL);
-            uint16_t discardedLength = static_cast<uint16_t>(initialLength - remainingLength);
-            VerifyOrReturnError(discardedLength <= mDiscardSize, CHIP_ERROR_INTERNAL);
-            mDiscardSize = static_cast<uint16_t>(mDiscardSize - discardedLength);
-            return CHIP_NO_ERROR;
-        }
     };
 
 public:
@@ -247,7 +227,7 @@ private:
 
     // Callback handler for TCPEndPoint. TCP message receive handler.
     // @see TCPEndpoint::OnDataReceivedFunct
-    static void OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBufferHandle buffer);
+    static INET_ERROR OnTcpReceive(Inet::TCPEndPoint * endPoint, System::PacketBufferHandle buffer);
 
     // Callback handler for TCPEndPoint. Called when a connection has been completed.
     // @see TCPEndpoint::OnConnectCompleteFunct
index 4d35eaf..aa78468 100644 (file)
@@ -24,7 +24,6 @@
 #include <transport/raw/UDP.h>
 
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/logging/CHIPLogging.h>
 #include <transport/raw/MessageHeader.h>
 
index a3e71e1..64be967 100644 (file)
@@ -22,6 +22,7 @@
  *      the Message Header class within the transport layer
  *
  */
+#include <protocols/Protocols.h>
 #include <support/CodeUtils.h>
 #include <support/ErrorStr.h>
 #include <support/UnitTestRegistration.h>
@@ -50,8 +51,7 @@ void TestPayloadHeaderInitialState(nlTestSuite * inSuite, void * inContext)
 
     NL_TEST_ASSERT(inSuite, header.GetMessageType() == 0);
     NL_TEST_ASSERT(inSuite, header.GetExchangeID() == 0);
-    NL_TEST_ASSERT(inSuite, header.GetProtocolID() == static_cast<uint16_t>(Protocols::kProtocol_NotSpecified));
-    NL_TEST_ASSERT(inSuite, !header.GetVendorId().HasValue());
+    NL_TEST_ASSERT(inSuite, header.HasProtocol(Protocols::NotSpecified));
 }
 
 void TestPacketHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
@@ -146,13 +146,13 @@ void TestPayloadHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
     uint16_t encodeLen;
     uint16_t decodeLen;
 
-    header.SetMessageType(0, 112).SetExchangeID(2233);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 0), 112).SetExchangeID(2233);
     NL_TEST_ASSERT(inSuite, !header.GetVendorId().HasValue());
 
-    header.SetMessageType(1221, 112).SetExchangeID(2233).SetInitiator(true);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 1221), 112).SetExchangeID(2233).SetInitiator(true);
     NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
 
-    header.SetMessageType(4567, 221).SetExchangeID(3322);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 4567), 221).SetExchangeID(3322);
     NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
     NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
     NL_TEST_ASSERT(inSuite, header.GetMessageType() == 112);
@@ -161,19 +161,19 @@ void TestPayloadHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
     NL_TEST_ASSERT(inSuite, !header.GetVendorId().HasValue());
     NL_TEST_ASSERT(inSuite, header.IsInitiator());
 
-    header.SetMessageType(1221, 112).SetExchangeID(2233);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 1221), 112).SetExchangeID(2233);
     header.SetVendorId(6789);
 
     NL_TEST_ASSERT(inSuite, header.Encode(buffer, &encodeLen) == CHIP_NO_ERROR);
 
-    header.SetMessageType(0, 111).SetExchangeID(222);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 0), 111).SetExchangeID(222);
 
     NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
     NL_TEST_ASSERT(inSuite, encodeLen == decodeLen);
     NL_TEST_ASSERT(inSuite, header.GetExchangeID() == 2233);
     NL_TEST_ASSERT(inSuite, header.GetVendorId() == Optional<uint16_t>::Value(6789));
 
-    header.SetMessageType(4567, 221).SetExchangeID(3322);
+    header.SetMessageType(Protocols::Id(VendorId::Common, 4567), 221).SetExchangeID(3322);
     header.SetVendorId(8976);
 
     NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
index 633f3fc..e8f91c6 100644 (file)
@@ -344,27 +344,21 @@ void TestData::Free()
 
 int TestDataCallbackCheck(const uint8_t * message, size_t length, int count, void * data)
 {
-    printf("--> callback %p %zu %d %p\n", message, length, count, data);
     if (data == nullptr)
     {
-        printf(" -> callback data null\n");
         return -1;
     }
     TestData * currentData = static_cast<TestData *>(data) + count;
-    printf(" -> payload %p total=%zu message=%zu\n", currentData->mPayload, currentData->mTotalLength, currentData->mMessageLength);
     if (currentData->mPayload == nullptr)
     {
-        printf(" -> payload null\n");
         return -2;
     }
     if (currentData->mMessageLength != length)
     {
-        printf(" -> length expect %zu got %zu\n", currentData->mMessageLength, length);
         return -3;
     }
     if (memcmp(currentData->mPayload + currentData->mMessageOffset, message, length) != 0)
     {
-        printf(" -> payload mismatch\n");
         return -4;
     }
     return 0;
@@ -429,22 +423,15 @@ void chip::Transport::TCPTest::CheckProcessReceivedBuffer(nlTestSuite * inSuite,
     NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
     NL_TEST_ASSERT(inSuite, gMockTransportMgrDelegate.mReceiveHandlerCallCount == 2);
 
-    // Test a chain that is too large to coalesce into a single packet buffer, followed by a normal message.
-    // We expect to receive only the latter.
+    // Test a message that is too large to coalesce into a single packet buffer.
     gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0;
     gMockTransportMgrDelegate.SetCallback(TestDataCallbackCheck, &testData[1]);
     NL_TEST_ASSERT(inSuite, testData[0].Init((const uint16_t[]){ 51, System::PacketBuffer::kMaxSizeWithoutReserve, 0 }));
-    NL_TEST_ASSERT(inSuite, testData[1].Init((const uint16_t[]){ 153, 154, 0 }));
-    testData[0].mHandle->AddToEnd(std::move(testData[1].mHandle));
-    // Start by sending only the first buffer of the long chain. This should be enough to trigger the error.
+    // Sending only the first buffer of the long chain. This should be enough to trigger the error.
     System::PacketBufferHandle head = testData[0].mHandle.PopHead();
     err                             = tcp.ProcessReceivedBuffer(lEndPoint, lPeerAddress, std::move(head));
     NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_MESSAGE_TOO_LONG);
     NL_TEST_ASSERT(inSuite, gMockTransportMgrDelegate.mReceiveHandlerCallCount == 0);
-    // Now send the rest, confirming that the second message arrives.
-    err = tcp.ProcessReceivedBuffer(lEndPoint, lPeerAddress, std::move(testData[0].mHandle));
-    NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
-    NL_TEST_ASSERT(inSuite, gMockTransportMgrDelegate.mReceiveHandlerCallCount == 1);
 
     gMockTransportMgrDelegate.FinalizeMessageTest(tcp, addr);
 }
index 6c84022..22fd11e 100644 (file)
@@ -28,7 +28,6 @@
 #include <protocols/Protocols.h>
 #include <protocols/echo/Echo.h>
 #include <support/CodeUtils.h>
-#include <support/ReturnMacros.h>
 #include <support/UnitTestRegistration.h>
 #include <transport/SecureSessionMgr.h>
 #include <transport/TransportMgr.h>